Page 1 of 1

resample does not honor "only shrink larger"

Posted: 2012-09-12T00:29:57-07:00
by figge21
I have an issue with resampling.

I cannot get -resample to prohibit upsampling.

I am trying the following:

Code: Select all

convert "infile.psd"[0] -resample 300x300> "outfile.tif"
since I only want to downsample very high resolution files and leave lower resolution files untouched.

Upsampling is usually a bad thing for quality, but in this case it is also murder for the server since the upsampling process can easily run away with all the memory, disk space and cycles.
Large camera images may come in as 4000x5000 at 72 dpi and the upsampling produces enormous images.

I am aware that resample is a wrapper on resize.
I am afraid that the constraint flags may simply be ignored by the wrapper.
Since I have not found any documentation expressing this limitation I would consider it a bug.

Re: resample does not honor "only shrink larger"

Posted: 2012-09-12T21:59:13-07:00
by anthony
I do not believe those flags are honored by resample at this time.

Re: resample does not honor "only shrink larger"

Posted: 2012-09-12T23:35:13-07:00
by figge21
Is this something you would consider fixing/adding in the near future?

Me no -- I have enough to do. But it is possible that "Magick" would.

Re: resample does not honor "only shrink larger"

Posted: 2012-09-13T09:26:14-07:00
by fmw42
You can achieve the same results by appropriately using -density and -resize. That way -resize will honor the ">" syntax.

I also think that you may get a better quality using -resize.

Re: resample does not honor "only shrink larger"

Posted: 2012-09-13T18:04:06-07:00
by anthony
fmw42 wrote:You can achieve the same results by appropriately using -density and -resize. That way -resize will honor the ">" syntax.

I also think that you may get a better quality using -resize.
Thay call the same function, just handle arguments differently, with -resample adjusting density too.

-resample can not use resizes argument handler, as that looks at actual pixel sizes. Now if resample did its size calculations, but then feeds them to resize argument handler, then the flags would be obeyed. But what if the resize was aborted, then the density substitution would also need to be aborted. No that gets messy. Resample would need its own version of flag handling as it maps its arguments to final image size for the lower level ResizeImage core library function.

Re: resample does not honor "only shrink larger"

Posted: 2012-09-14T00:35:57-07:00
by figge21
I know that I could rework the command to substitute -resample with -density and -resize/-geometry but since I never know the properties of incoming images in advance I would need to interrogate each image in order to build an appropriate command.
-resample is a wonderful shortcut that would allow me to batch any set of images through with a predictable outcome if only I could suppress upsampling.