The Coldfusion Open Source Forums
Home | ImageCFC | CFFM | BlogCFM | CFMBB | CFOpenMail / ImapCFC | CFOpenChat
Forums | Profile | Inbox | Members | Chat | Search | Login | RSS
Vivio Technologies Dedicated Hosting
New Topic Reply Subscription Options   Previous Page  Page: 1   Previous Page

Forums: ImageCFC Forum: Image quality on resize
Created on: 08/29/07 {ts '2018-04-23 07:39:00'} Views: 16446 Replies: 5
Image quality on resize
Posted Wednesday, August 29, 2007 at {ts '2018-04-23 07:39:00'}

Hi, first post here so I start with a big Thank You for bringing us ImageCFC.

I am using it mainly to resize and crop images to web friendly sizes and it all work well except for the quality (!). To get a decent image quality on thumbnails and smaller images I need to blur the image before resizing to avoid strange effects and jagged edges. I do like:


if (newWidth gt 400){
blurMe.amount = 1;
blurMe.times = 3;
}
else //thumb
{
blurMe.amount = 3;
blurMe.times = 7;
}

imageCFC.scaleWidth(imageCFC.filterFastBlur("", resizeSource,_
"",blurMe.amount,blurMe.times,100).Img,"", requestedImagePath,newWidth,90)

I have actually lot more variations on amount/times but I just wanted to show the principle.

Problem is that It is pretty tricky to get decent values for each size as it involves a lot of subjective evaluation of test cases.

Another problem is that I have no clue how this is usually done. In Photoshop and ImageMagick I never need to blur anything. Is that because they do it automagically or is it something I do wrong with ImageCFC?

If it is indeed so that blurring the images before resizing, as I do, increases the pic quality - maybe it should be added as a builtin function in ImageCFC? Maybe a 'useSmooooooothing' parameter on resize?

One of my worries is that ImageCFC will suddenly one day start doing it automatically and my existing code will then destroy/overblur everything.

Best Regards

Stefan

Edited 08/29/07 {ts '2018-04-23 07:41:00'}
RE: Image quality on resize
Posted Wednesday, August 29, 2007 at {ts '2018-04-23 08:31:00'}

The quality of imageCFC output is limited by the java graphics libraries capabilities, unfortunately. You'll find the some quality issues with tmt_img, Alagad, and any other java-based imaging companent.

This is not something that can be fixed... and I'm probably not going to automate any kind of blurring functionality into the resize method because it's a hack.

If you're REALLY concerned about image quality, I would recommend CFIMAGE (coldfusion Cool or ImageCR from Efflare (a CFX tag)

Rick Root
I'm not certified, but I have been told that I'm certifiable!

www
RE: Image quality on resize
Posted Wednesday, August 29, 2007 at {ts '2018-04-23 08:52:00'}

Thanks for your reply. I run Linux CF7, so I seem to be limited to ImageCFC or JMagick. I used to run JMagick but I had problem keeping it stable.

I agree with you that the blur option is a hack, but it is a necessary hack! In my real app I choose blur amount from percentage of resized vs original rather than the rough version in my example code above. The difference between a pre-blurred resize and a normal resize is huge.

RE: Image quality on resize
Posted Wednesday, August 29, 2007 at {ts '2018-04-23 08:59:00'}

For what it's worth, what you're doing is exactly why I added the blur filter to imageCFC =)

Rick Root
I'm not certified, but I have been told that I'm certifiable!

www
RE: Image quality on resize
Posted Wednesday, August 29, 2007 at {ts '2018-04-23 09:11:00'}

Maybe I write a subcomponent that simply calculates reasonable values form source & target parameters, like: structBlur=myImageCFCAssistant.getDecentBlurSettings(sourceSize,targetSize);

and make it available for download...

Not really a big deal, but I wanted to make sure I had not missed something obvious since I needed the blur Smile

RE: Image quality on resize
Posted Tuesday, May 17, 2011 at {ts '2018-04-23 18:04:00'}

Hey everybody,

Thanks a lot for imageCFC, for us its a practical bridging for image resizing until we move to an up-top-date CF server this year.

I have found another approach than Stefan's bluring method which i'd like to share.

As a read the definition on the bicubic interpolation method of java I realized that it only uses the 16 closest points of any point to recalculate the values when resizing. Now when the start image size is very different from the targeted image size (e.g. for thumbnails), this interpolation completely fails in terms of quality.

What I've tried is to resize the image step-by-step. What would be logic to me would be dividing the size by half on every iteration, but interestingly I got the best results by reducing the image size by 25 pixels at a time... Now when you start from a 1000 pixel image, thats a lot of iterations and should not been done on the fly/online, but with some kind of pre-calculated image store. You also have to make sure to keep jpeg compression to 100 on all the iterations exept the last (where you choose your target compression).

Hope this is helpful to anyone.

Cheers,
tom

New Topic Reply Subscription Options   Previous Page  Page: 1   Previous Page
Subscription Options
Subscription options are available after you log in.

There are 43 active user sessions right now.