Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
This tag is for questions related to the loading, formatting, saving, compression, and display of data representing pictures.
4
votes
Accepted
Grepping for text in images
Overall I think this is pretty nice code.
Make the UX more friendly
It's an error when:
the specified path is a directory and --recursive is not used
the specified path is a file and --recursive is u …
6
votes
Accepted
Colored image will become black and white
Input validation
If the received image is not RGB, throwing an IllegalArgumentException without a custom message is not very friendly. …
2
votes
Accepted
Bash function to produce variants of images at 2X and 3X resolutions
Double-quote variables used as command line arguments
Instead of this:
convert $1 -crop $2 "two.png"
Write like this:
convert "$1" -crop "$2" "two.png"
This is to protect from word splitting …
2
votes
Upload image from Remote Server using URL
Single responsibility principle
The uploadRemoteImage is doing too much:
determine image type
set output path
decide output method
execute output method
It would be better to create smaller functions … default:
die('Not a valid image type');
$image_create_func = 'ImageCreateFromJPEG';
$image_save_func = 'ImageJPEG';
$new_image_ext = 'jpg';
Closing files as soon as possible
You're …
3
votes
Accepted
Directory of Snapshots
Your if conditions can be simplified. Instead of this:
if ( `tcsh -f -c "ls -1 DSC*.jpg >& /dev/null" && echo yes` == "yes" ) then
You could write like this:
if ( `ls DSC*.jpg >& /dev/null && echo …
11
votes
Accepted
Turning music into an image
/ Bitmap signature
bmp[1] = 0x4D; // 'BM'
bmp[2] = 0x1C; //
bmp[3] = 0x1B; // Size of bitmap
bmp[4] = 0xB7; // in bytes
bmp[5] = 0x00; //
bmp[10] = 0x1A; // Image … data location
bmp[14] = 0x0C; // Size of header
bmp[18] = 0xDC; //
bmp[19] = 0x05; // Dimensions of image
bmp[20] = 0xDC; // 1500 * 1500
bmp[21] = 0x05; //
bmp[22] …
2
votes
Accepted
Making time lapse screenshots using Bash
Your questions
Does anything stand out in terms of things done horribly wrong, in any way?
It's nicely written, easy to read. Many things can be improved, but the way you've written it is …
2
votes
Diagonal gradient optimization
I don't think there's a lot you can improve here. I would use temporary variables to reduce the repetition in i + j and w + h, and extract the common transformation operation to a function:
Uint8 tra …
4
votes
Accepted
Handling large images efficiently (to avoid OutOfMemoryError)
I suspect that if you call BitmapFactory.decodeResource(...) 3 times, o.outWidth will have the width of only the last image. … So you might want to rework this, extracting the main processing to a private method, and running it for each image separately. …
2
votes
Accepted
Circuit-Swap mechanism on going (BMP->PPM)
In fwrite_ps, the purpose of the switch seem to be to rotate the values of p as 2 -> 0 -> -2. Unless I'm overlooking something, it seems to me you could use i and some modulo and arithmetics for the s …
2
votes
Accepted
Responsive image code
There's a lot of duplication in this code.
Instead of this:
if (currentWindowWidth <= 640) {
flagIs = "mobileLowEnd";
}
else if (currentWindowWidth >= 641 && currentWindowWidth <= 768) {
f …
1
vote
Accepted
Storing Data In a Image pixels
In this code:
var i, pair, char, hex;
for(i=0; i < charHexPairs.length; i++)
{
pair = charHexPairs[i];
char = pair[0];
// ...
There's no need to declare the variables in a …
4
votes
Image Cropping and Resizing
Use range
The loop over sizes doesn't use the loop index, so it can be written more idiomatically using range:
for _, size := range sizes {
// ...
}
Variable declarations
At many places you d …
3
votes
Check image dimensions, calculate aspect ratio, set image dimensions, resize
This line is too long:
var ua = navigator.userAgent; var event = (ua.match(/iPad/i)) ? 'touchstart' : 'click';
It would be better to split into two:
var ua = navigator.userAgent;
var event = (ua …
4
votes
Accepted
Do my Image Widths Exceed Limit?
Some questions (and again) on Stack Overflow suggest some issues with releasing image resources when opened with Image.FromFile. … Directory.GetFiles("C:\\Users", "*.png", SearchOption.AllDirectories);
foreach (string file in files)
{
using (FileStream fs = new FileStream(file, FileMode.Open, FileAccess.Read))
using (Image …