Image resizing.

Archived from the Transloadit support forum. Originally posted on December 24, 2010; details may be outdated, see our docs for current behavior. Original thread

Hello,

Is it possible to re-size only images that are larger than specified width or height? ie: images smaller than the specified width and height will not be stretched.

Thanks

PS I already posted this question at http://transloadit.com/docs/image-resize#resize-strategies as I don’t know how ofter the pages are checked.

No, not yet. However, we are going to make the logic governing the execution of steps more flexible in the future to allow this.

PS I already posted this question at http://transloadit.com/docs/image-resize#resize-strategies as I don’t know how ofter the pages are checked.

We get email notifications for all comments, so generally it doesn’t matter where you post. Anyway, I also answered your question in the comments so everybody can reference it:

http://transloadit.com/docs/image-resize#comment-119108033

Let me know if you have any other questions I can help with!

So, my question on the image resize/processing front was about being able to specify cropping co-ordinates - I posted this on the image-resize doc too.

Will that be includeable with the improvements you’re making?

G

Gavin: Yes, we will add support for cropping with coordinates as well and update this ticket when it’s ready.

What’s your time frame on this?

we’re doing all our stuff manually right now, so our timeframe is ‘when you’ve done it’ :slight_smile:

It’s not a total blocker to our implementation, but it will make our implementation much more elegant.

“Manually” just meaning all in house, not via transloadit api.

I’m running into the same issue myself. I run a service that allows artists to create an online portfolio and it’s quite important that if an image does not need to be resized it isn’t. i.e. when someone uploaded a small image (smaller than the max width/height) they probably intended it to show up small on their portfolio.

Currently the only way to support this would be to save the original as well and then show that instead of the resized version it’s smaller than the maximum dimensions. That also means i’ll always have to save originals even if someone felt the need to upload a 2GB source file from their gazillion pix digital camera. needless to say that’s less than ideal.

Most resizing software, including imagemagick, offer a stretch=false parameter or something along those lines, it would be great if the resize robot would allow us to set that option…

Advice taken. We are having a team discussion about this in 5 minutes.

Kind regards,
Tim

Great! Thanks.

Gah, I guess I missed your standup Tim, hope you spared some moments to cover cropping too :smiley:

@Gavin: Yeah I implemented cropping yesterday. It’s currently in the final review process and will most likely be released tomorrow.

The way it will work is that you can specify an object crop_coords which receives values for x1, y1 and x2, y2 to specify the top left and right bottom points of the cropping. If the crop_coords parameter is set, the width and height parameter will be ignored. Let me know if this would work well for you.

@Tijs: We have discussed this and came to the conclusion that the proper way to do this would be via a new filter robot that can receive any kind of conditions (ORs, ANDs, ..) and filters files with that based on their meta data. The thing is we want to keep our robots simple. If I add such a magic parameter to the image resize robot now, we’ll have plenty of these kinds of parameters for all other robots as well sooner or later, which is not desirable.

I’ll start implementing it tomorrow, but I doubt it will be released before next week. Let me know if that’s okay with you.

Kind regards,
Tim

I don’t think i would need conditional filters just the parameter would do. but feel free to knock yourself out. would be great if it could be in there next week, in that case i’ll just work on prettifying the upload interface and error handling first.

@Gavin: Having trouble compiling an ffmpeg version to run all tests. Seems cropping will be delayed a bit. Sorry. :confused:

All good Tim, now that we know you’re in the ballpark, we’re planning to work this in “in February” so no problem on our side.

That approach should work well for us - thinking about the flow we’ll need in our app:

  1. user uploads their image
    -– transloadit has the image, puts it on s3 for us
  2. our site displays the image (from s3) to the user in a js crop interface
  3. our site takes users crop co-ords and…

A – downloads from s3 and then re-uploads to transloadit the file from s3?
B – transloadit allows us to specify a URL of the image, living on s3, plus crop co-ords and transloadit will make a new image, and put it on s3?

Thoughts on how this flow completes?

G

Hey Gavin,

yep that looks good.

For 3. you could use the http/import. As the url will be dynamic you’ll need to supply your assembly steps in the form’s params field. You can also tell TL the path and filename of the file in the bucket, so no problems there.

:slight_smile:

Hey Gavin,

coordinate cropping has landed. Check out http://transloadit.com/blog/2011/01/cropping-by-coordinates-has-landed.

@Tijs: The parameter is coming. In fact I implemented it already and it’s in the final review process. I will not document it because we still think the filter robot is the best way to do this. However, this parameter allows you to implement your features as needed. The filter robot is still a couple weeks if not more away.

I will let you know once it is released.

Great news guys. And thanks for building in a hidden feature then :slight_smile:

I’ll make sure to move to the filter option once available then so your not stuck supporting undocumented features until infinity..

any news on when you expect the magic parameter to drop? would be cool if i could build this in over the weekend…

Hey Tijs,

sorry for the delay, but our CI server has some connectivity problems. All tests pass locally for me, though. Can’t deploy that without the CI server passing though. :slight_smile: Well I could, but I don’t want to. :stuck_out_tongue:

Will let you know when it’s in there. The parameter will be called “dont_zoom”, will be false by default and if set to true will give you your desired behavior.

Best
Tim

Hi Tim,

Thanks for the update! I’ll just start implementing it then with that param name. That way i should be able to deploy the new uploads as soon as it’s live.

Tijs