Imageresizer doe not crop the width but only crops the height - imageresizer

Having an issue with my images not being cropped using imageresizer. It crops fine on the height but does not crop the width.
here is an example: https://media.hillarys.co.uk/asset//media/10222/zen-collection-mishima-dawn-curtains.jpg?width=850&height=450&mode=Crop&quality=70
If I set the height to 400 it crops fine. However if I set the width to 300. It will resize the image.
This is really starting to get frustrating now. Any help?
Thanks

I see an image that is 850x450 pixels.
mode=crop (compared to mode=max or mode=pad) minimally crops to achieve the required aspect ratio, then scales the image down the the precise dimensions you requested.
If you don't want a minimal crop, then you should use crop=x1,y1,x2,y2. These can be expressed as percentages instead of coordinates with cropxunits=100&cropyunits=100.

Related

when i resize big tiff image to less than 25% ( say 17% ), the pixels are wrapped from left to right

im using image magick v7.16.0. i have a very big image of size 440*1700. i want this to be resized to 17% of the original Size.
I tried with Resize, Scale and Rescale methods with intended width/height parameters and also with MagicGeometry.
But the resized image wraps the pixels from left side to right side.Click here for the image
Can any one help me in understanding why this wrapping is seen ?
This wrapping is seen only when i resize to less than 25%. [ when i resize to 50% or 80% i dont see this wrapping ]

How to crop based on scaled dimensions?

Is there a way to scale an image down in size by say, 50 percent, and crop the scaled output? I've been tinkering with this, but it seems that any cropping is based on the original image dimensions rather than the scaled dimensions.
Cropping by percentage:
?crop=20,20,80,80&cropxunits=100&cropyunits=100
Cropping by the output size:
?width=400&height=300&crop=80,60,320,240&cropxunits=400&cropyunits=300

drawInRect loses resolution when drawn to smaller image?

When i draw a large image (say 1000x1000 pixel) using drawInRect method with size say 200x200 pixel and again i use drawInRect method to draw the image to its original size (1000x1000 pixel) does the resolution affect by using this ? Does the resolution decreases by drawing large image into small and again that same image to large image ?
Hopefully I've gotten your question correct in my head.
If you take an image bigger than 200x200 pixels and draw it into a 200x200 pixel rectangle, it'll get scaled down and lose most of its detail. If you then take the resultant image and try to draw it in a bigger rectangle it'll just get scaled up. So, to answer you're question, yes. It'll look blurry as hell. It's no different than resizing an image down in a graphics editor then blowing it back up to its original size. The loss of detail is permanent; there's no way to know what was lost in the transition down.

setting the resizing and cropping options correctly

I am using your resizer tool, it works very well, I am stuck at one place and need your suggestion to help me choose the correct image resizer settings
Everythings works fine when image is smaller than the browser window size I got problem when it's bigger than browser window
I am using the following parameters
orig.jpg?width=1600&height=530&mode=crop&scale=downsizeonly
for example consider a portrait image scenario given below
Browser window size = 1600 Width x 530 height
Original Image size = 1024 Width x 768 height
expected result: 1024 width x 530 height (so it should crop the remaining height)
actualt result: 1600 with x 530 height
Height and its cropping is ok but 1600 width is wrong I want it to be 1024 width so image didn't loose quality
Vise versa functionality I need for Landscape image
What parameter should I use?
The automatic cropping can cause upscaling even when &scale=down IF the requested dimensions would normally NOT cause upscaling with &mode=max or &mode=pad.
This is a known bug that will be fixed in a future release.

Scaling an image from the iPhone - iOS App

I let the user select a photo from the iPhone library, and I grab the UIImage.
I output the size of the image, and it says 320x480, but it doesn't seem to be, because when I draw the image on the screen using CGRectMake(0,0,320,480), it only shows the upper left portion of the image. Aren't the images much bigger than 320x480 because of the high resolution?
I'd like to scale the image to force it to be 320x480. If it is less than 320x480, it should not be rescaled at all. If the width is greater than 320 or the height is greater than 480, it should scale in a way so that it becomes as close to 320x480 as possible, but by keeping the proper proportion of width to height. So, for instance, if it scales to 320x420, that is fine, or 280x480.
How can I do this in Objective-C?
Setting the image view's content mode like this:
myView.contentMode = UIViewContentModeScaleAspectFit;
will preserve the aspect ratio.