I need to be able to scale up a small image to a custom image size so an exact crop can be made. I can’t find a plugin or code example that does this, can anybody help?
Let’s say I upload an image 400×200. I have added add_image_size('featuredImage', 650, 300, true); and currently I get a 650×300 image, but it only contains the 400×200 image top left and the rest is black. What I need is the uploaded image upscaled to 650×325 and the crop taken from that. Original should not be altered.
This is what everyone always wants to avoid doing. When you scale up, where would the extra resolution come from? Typically, the algorithm is to double all the pixels. So if you choose a size that is not double the original, which pixels do you treat differently?
I have read this article about a workflow that produces good images by upscaling 20% more than the desired size and then going down to that size, but it works because it is using particular tools in Photoshop. http://www.outbackphoto.com/workflow/wf_60/essay.html
Those tools are not built-in to PHP, although there are image tools, I don’t think all sites have them installed by default.
My point wasn’t about quality. It was about how the algorithm actually creates a larger image from a smaller one. PHP doesn’t have that built-in. You have to have the right graphics library to get some functions, and not all servers have that.
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘Scaling up small images and cropping to specific (exact size)’ is closed to new replies.