anthony wrote:In what way is it wrong?
The final image should fit within 512x512px. Both source images have all dimensions bigger than this, and also have the same proportions. The output image in both cases should have been the same size but the one derived from the larger image has a height of 512px (wrong) while the smaller one has a width of 512px (correct). Of the batch of images I ran every image <10,000px resized as expected and every image >10,000px resized incorrectly.
anthony wrote:You asked to shrink large images only (you should escape the '>' character!)
That's what the "^" is for. I forgot to also mention that I'm running this via a batch file.
anthony wrote:...and make the shorter length 512 as per the '^' flag. (That is given dimensions are to fit inside the resulting image)
The second example looks like the '^' was not seen.
Could you be working with DOS where '^' is special in some situations?
The '^' is used to escape the '>' ie. my command line should be equivalent to
Code: Select all
convert in.tif -resize 512x512\> out.jpg
Referenced from:
http://www.imagemagick.org/Usage/windows/#conversion and
http://www.imagemagick.org/Usage/resize/#shrink
I can generate similar errors with a database if the input image height and width fields are stored as text. Calculating the dimensions of the resulting output image will produce the same results and will be "fixed" by simply changing the field type of the image dimension fields to numerical.
Using the large image from my example, calculate ratio of input:output image sizes as
maximum (height,width) / 512
Results in (7230 / 512) if the fields are text and (10192 / 512) if the fields are numbers.
[edit]It's possible that the only reason the images smaller than 10000px worked was because all dimensions were larger than 1000px. With both height and width having the same number of digits it doesn't matter whether it's treated as text or numbers. I'll investigate this further when I get home.[/edit]