How can I disable image upscale?
AnsweredHi,
I can not find a way to make cloudinary not to upscale(resize up) images smaller than specific dimensions.
For example if I have a 200x300px area I want to achieve the following results:
- image 50x50px - not resized
- image 200x400px - resized to fit the area
Thanks in advance for the help.
Greetings,
Ilian
-
You can use the 'limit' mode. For example:
http://res.cloudinary.com/demo/image/upload/w_200,h_300,c_limit/face_left.jpg
See the following article for more details:
0 -
Thanks a lot )
0 -
Hi,
I have a similar problem, although in my case I want to use the fill cropping mode while preventing upscale. Basically, I want something like this:
http://res.cloudinary.com/demo/image/upload/w_250,h_150,c_fill,g_faces/butterfly.jpg
However, if the image would need to be upscaled to fit the specified size (like for example here: http://res.cloudinary.com/demo/image/upload/w_1000,h_600,c_fill,g_faces/butterfly.jpg), I'd like the original to be returned.
I've browsed the documentation quite a few times now, but I can't find any way to achieve this. Is this really such an uncommon use case?
Thanks a lot and cheers,
Daniel
0 -
Hi Daniel,
The definition of the 'fill' mode is to fill exactly the requested dimensions, whether smaller or larger than the original image's dimensions.
The 'fit' and 'limit' modes ensure that the original image is not scaled up, but they create a different result from the fill mode.It is in our to-do list to support upscale disabling when using the 'fill' mode.
We'll update you when it's ready.
0 -
Hi Itay,
thanks for your response! What you have written was actually exactly my understanding after reading the documentation and the reason for my question. Is there any schedule on when to expect this feature? I think that preventing upscaling is a really important functionality, because upscaling images is very rarely what you want to do.
Cheers, Daniel
0 -
Hi Daniel.
The system was updated today with a new crop mode called 'lfill' (a shortcut of 'limited_fill').
It acts the same as 'fill' but does not scale up either the width or height of the original image. This means that if the requested dimensions are smaller in both axes then the resulting image is the same as in the 'fill' mode. Otherwise, the generated image is smaller than the requested dimensions.
Here are the same examples you mentioned, this time with the new 'lfill' parameter:
The image in a smaller scale than the original:
http://res.cloudinary.com/demo/image/upload/w_250,h_150,c_lfill,g_faces/butterfly.jpg
The same image in a larger scale than the original (preventing the upscale):
http://res.cloudinary.com/demo/image/upload/w_1000,h_600,c_lfill,g_faces/butterfly.jpg
Thanks,
Itay
0 -
Hi Itay,
wow, that was quick - thanks a lot! Works exactly like I had envisioned. :-)
Cheers, Daniel
0
Post is closed for comments.
Comments
7 comments