Resize and Crop an image using a single convert() action - filepicker.io

I'm currently looking to try and create a simple image uploader application which allows a user to load a picture from their desktop, select a crop area (using jcrop) in a specific aspect ratio, and then have filepicker.io crop to the defined dimensions and resize down appropriately.
The users will be uploading a picture of unknown dimensions, selecting an area that is in 10:13 ratio (width x height) and then filepicker needs to crop their image before resizing it to 100x130px.
Currently I have to perform 2 separate convert actions to crop and resize the image, which takes additional time and seems less efficient than it could be. Is there any way to combine crop and resize into a single action?
To get an idea of what I'm after, I would like this command to return an image 100x130 cropped to my ideal size:
/convert?crop=546,119,412,36&w=100&h=130

You can see a note on their documentation about the topic:
Crop and Resize: we strongly recommend against combining a resize (specifying width or height) with the crop functionality, as it has indeterminant effects depending on whether the crop is applied before or after the image is resized.
Source: https://developers.inkfilepicker.com/docs/web/#inkblob-images

It is possible and easy to do with Uploadcare
Here is an example:
Original image:
https://ucarecdn.com/c35d77e8-4b09-4040-ad36-a5b264f17094/CDN.png
Cropped and resized image, in one operation:
https://ucarecdn.com/c35d77e8-4b09-4040-ad36-a5b264f17094/-/crop/570x460/730,70/-/resize/200x150/Resized_CDN.png

Related

How to fill an image on flutter canvas?

I have a class that extends CustomPainter, which helps me to draw an image on the canvas (with canvas.drawImage) and plot some points (with canvas.drawLine and canvas.drawPath) on top of the image. However, I have trouble figuring out how to scale or translate the image so that it fills / covers the canvas (about 60% of the image from the center should be displayed within the screen size of the device). The image can be bigger or smaller than the device's screen size, but they all have a fixed aspect ratio (4:3). I would like to fill the image on the canvas (following the 60% rule above) and scaling them according to their original aspect ratio.
A pseudocode or a general idea on how to do this would be appreciated.

How to keep the same resolution of canvas on different screen resolution?

First of all, sry for my English mistakes, I'm not a native English speaker.
I'm trying to make an UI which is composed of a canvas within different gameObject, and I would like that my canvas scales to the dimension of the screen but keeps its original resolution (16x9 portrait). If it is displayed on a tablet resolution (4x3) then an image is displayed in the space that is not covered by the canvas.
But actually all I've got is a canvas which scales to every resolution, and it changes the aspect of its child (for example a square becomes a rectangle).
Thank you for showing interest in my query!
UI's are heavy beasts. Canvas in Unity have a component attached to themm called Canvas Scaler which is set by default on Constant Pixel Size. You may try to set this property on Scale With Screen Size and then specify the base resolution you want to work with (usually 1920x1080 is a console standart). This is your first step
Then, to avoid strange Image scaling, you may check the property Preserve Aspect, this way the ration of the Sprite into your Image will remain the same indepently of the ratio of the Image
Last, you may play a bit with anchors but this is another story, you should let those at plain center at the beginning and come back to it when you will feel ready
Hope that helped ;)
Your canvas should have a component called Canvas Scaler. Here it should say Constant Pixel Size, change this to Scale With Screen Size and it should lock the Canvas to be the same width / height as the screen. If you want to lock an image to a specific width/height ratio, go to the Image component on the image and check the Preserve Aspect checkbox. This way if you have a 100x100 image, the images width will always be the same as the height. If you have a 200x100 image, the images width will always be twice the height, etc etc etc.

Image quality downgraded after resizing in AEM 6.3

I'm very new to AEM and I'm trying to reduce the image size by using named transform image servlet in AEM 6.3. After reducing the image size using resize property, the image quality goes down terribly.
I've also tried using attributes sharpen and quality however I'm not able to understand their proper usage even after going through the adobe docs.
This is the original image resolution
1600 x 530
This is the image configuration that I've tried so far:
bounded-resize:width=1423&height=471&upscale=true (using this only reduces the image quality a lot)
quality:quality=82 (this changed nothing)
sharpen:op_usm=3.5,20(this distorted the image completely, sort of oil paint effect)
Above configuration maintains the aspect ration but not the quality.
Need to know what wrong I've done in this and how do I REDUCE THE IMAGE SIZE WHILE MAINTAINING THE ASPECT RATIO AND IMAGE QUALITY.
You should check the order of Image Transformers in your transformer configuration. The documentation states:
Order matters when defining your image transformation rules. For example, a resize then crop can yield significantly different results than a crop then resize.
I am not a 100% sure which makes more sense: Resize and Crop or Crop and Resize. But that would be easy to validate:
Create two transformer configurations. Both should just contain the resize and crop setting but in a different order. Call both of them (with the right URL) and then compare the resulting images.
how do I REDUCE THE IMAGE SIZE WHILE MAINTAINING THE ASPECT RATIO AND
IMAGE QUALITY.
As a best practice, to achieve a high image quality and small file size, start with the following combination of parameters:
fmt=jpg&qlt=85,0&resMode=sharp2&op_usm=1.75,0.3,2,0
This combination of settings products excellent results under most circumstances.
For further reading and learning, Refer to this

How to fit a large image in image view without stretching the image?

I am using a image view and its size is (320X480). i want to fit a image which size is (800X600) in image view without stretching the image. i tried to make the image 320X480 but its quality becomes poor. Thanks for any solution.
320x240 would be the same aspect ratio. Notice, 800/600 = 4/3 and 320/240 = 4/3.
Also, in the future a tool like ImageMagick can allow you to resize an image to fit within some bounding box while maintaining aspect ratio.

iPhone - save image at higher resolution without pixelating it

I am using the image picker controller to get an image from the user. After some operations on the image, I want the user to be able to save the image at 1600x1200 px, 1024x1024 px or 640x480 px (something like iFlashReady app).
The last option is the size of image I get in the UIImagePickerControllerDelegate method (when using image from camera roll)
Is there any way we can save the image at these resolutions without pixelating the images?
I tried creating a bitmap context with the width and height I want (CGBitmapContextCreate) and drawing the image there. But the image gets pixelated at 1600x1200.
Thanks
This is non-trivial. Your image just doesn't have enough data. To enlarge it you'll need to resample the image and interpolate between pixels (like photoshop when you resize an image).
Most likely you'll want to use a 3rd party library such as:
http://code.google.com/p/simple-iphone-image-processing/
This performs this and many other image processing functions.
From faint memories of computer vision class from long ago, I think what you do is to blur the image after the up-convert.
Before drawing try adjusting your CGBitmapContext's antialiasing and/or interpolation quality:
CGContextSetShouldAntialias( context, 1 == 1 )
CGContextSetInterpolationQuality( context, kCGInterpolationHigh ) ;
If I remember right, antialiasing is turned off on CGContext by default.