The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 18, 2019, 06:58:07 PM

Login with username, password and session length


Pages: [1] 2
  Print  
Author Topic: Question re. GD and JPG resizing  (Read 3435 times)
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« on: May 14, 2009, 02:20:06 PM »

I have a task where I need to resize a metric ton of photos into different sizes. The geometry is the same, just need to be different sizes. I'm about 99% certain that this will be a breeze in GD (I'll probably just script it in PHP) but my question goes to quality - does anyone have any data or experience on the quality of a resize/rescan? Will I lose a lot of clarity by going GD rather than, say, building a workflow in Photoshop?

Any opinions appreciated...
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
nop_90
Global Moderator
Lifer
*****
Offline Offline

Posts: 2203


View Profile
« Reply #1 on: May 14, 2009, 02:32:03 PM »

Looked at the API docs for GD
(granted it was the python binding)
GD docs
copyResizedTo(image[, (dx,dy)[, (sx,sy)[, (dw,dh)[, (sw,sh)]]]])
    copy from (sx,sy), width sw and height sh to destination image (dx,dy), width dw and height dh

If you look at the PIL docs (that is a different image library for image manipulation with python)
im.resize(size, filter) => image

The filter argument can be one of NEAREST (use nearest neighbour), BILINEAR (linear interpolation in a 2x2 environment), BICUBIC (cubic spline interpolation in a 4x4 environment), or ANTIALIAS (a high-quality downsampling filter). If omitted, or if the image has mode "1" or "P", it is set to NEAREST.

PIL offers different methods for resizing.
I have no idea what type of methods photoshop uses to resize, but being a professional image proggie I imagion it does not use just simple "NEAREST"
So if u are really that concerned about image quality find a better image manipulation library for PHP (there are others out there i am sure)

Logged
rcjordan
Lifer
*****
Offline Offline

Posts: 882


View Profile
« Reply #2 on: May 14, 2009, 02:34:10 PM »

Are you expanding or downsizing?  Either way, my experience has been that quality can suffer significantly among apps.  If resized output is for the web, then the loss may be tolerable. If, OTOH, you're messing around with Pinkhat's favorite photo collection, proceed with caution.

Are you stuck on serverside? Clientside, Irfanview has a batch resize that's good. But I have another clientside app that uses the lazos algo and does a great job for downsizing in batch mode.
Logged
rcjordan
Lifer
*****
Offline Offline

Posts: 882


View Profile
« Reply #3 on: May 14, 2009, 02:38:42 PM »

<added>
I've written some image-handling (resize/watermark) in GD/PHP but the quality never seemed quite as clear as I could achieve clientside.
Logged
rcjordan
Lifer
*****
Offline Offline

Posts: 882


View Profile
« Reply #4 on: May 14, 2009, 02:54:33 PM »

>lazos algo

For Windows clientside batch resizing, this is the best I've found.  "Thumbnails" is misleading, btw.  Point it at a directory and select resampling filter Lanczos3.

http://www.fookes.com/ezthumbs/?Easy%20Thumbnails=2800
Logged
nop_90
Global Moderator
Lifer
*****
Offline Offline

Posts: 2203


View Profile
« Reply #5 on: May 14, 2009, 03:16:42 PM »

@rcjordan
Never heard of lanczos filter till now, might be interesting

Logged
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #6 on: May 14, 2009, 03:57:52 PM »

@ RC - all downsizing. Looking at a way to reduce the workload on a partner who has about 500+ photos that need to be redone. She'd like to do it all in the largest size for web presentation, then have me batch them to the gallery and thumbnail size. Fortunately, the base photo has high resolution and clarity, so I think that downsizing it should produce a pretty good result.

@ server/client - doesn't matter at all. The final result needs to be a cured and stored .jpg available for my sites - the process to get there is immaterial. However, I'm not much a Windoz guy so that does color things just a titch. I'm going to take a look at Adobe workflows as well just on GP - haven't done one, but if I do one with both Adobe and GD, I should have a pretty clear picture on the quality difference.

@ Nop - thanks for that data, very helpful. Looks like talking to the GD lib is pretty similar among languages, so your info seems instantly applicable. I'm thinking of the Antialias as my first test, Time is not a factor here at all ... if it takes a minute per photo I could care less. So I'm going to look at the methods you've described and see if I can put together a clean process for us to use going forward.

Thanks guys.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
vsloathe
vim ftw!
Global Moderator
Lifer
*****
Offline Offline

Posts: 1669



View Profile
« Reply #7 on: May 15, 2009, 06:34:12 AM »

Yeah I'm not sure what rcjordan means when he differentiates between serverside or clientside image resizing. Why would you upload an image to a server just to resize it? PHP runs just fine on all my workstations.
Logged

hai
rcjordan
Lifer
*****
Offline Offline

Posts: 882


View Profile
« Reply #8 on: May 15, 2009, 09:37:31 AM »

>Why would you upload an image to a server just to resize it? PHP runs just fine on all my workstations.

This is sort of a lifestyle issue. In the pro site development/management field (like here), I run into a few guys who work AT their *nix server, so little windows/mac apps aren't going to work for them. Normally, they have better, or at least more powerful and more customizable tools for data/file management.  Where they usually hit the wall, though, is in image manipulation.

>upload

Funny you mention that, as I spent the last 2 years struggling with the best way to handle massive numbers of images on a remote server. For 7 or 8 years now, we've manipulated them clientside, then uploaded. I should note that we pack html and text inside the jpg binary, so the end product is more elaborate than a simple jpg.  In a word, the problem is normalization.  Doing it clientside (or on a workstation) leaves a trail of image copies --generated while the work was in progress. After a while you make a mistake and nuke your masters, or you spend a day trying to decide if that folder from a year ago IS the master set, etc.  I've decided that I'd rather have someone upload once at full image size and let the server do whatever I want.  In this case, the problems I've had with GD/PHP won't matter, so I'll go that route.

I manage about (guesstimate, may be more) 8k-12k pictures online.  It's been my experience that I can't get the best quality out of GD/PHP ...that's not to say that someone else can't, but it's like Perk said about macro languages in a recent thread, I could have resized 5k photos retaining excellent quality using desktop apps in less time than we've spent on posting this thread.

>Fortunately, the base photo has high resolution and clarity, so I think that downsizing it should produce a pretty good result.

Going from a very large format (say, 8 megapixel) to something like 500x320, I've experienced some problems ...usually jagged edges.  If it's 2m, no problem.
« Last Edit: May 15, 2009, 09:45:49 AM by rcjordan » Logged
ehlo
Journeyman
***
Offline Offline

Posts: 50


View Profile
« Reply #9 on: May 15, 2009, 10:47:18 AM »

For my resizing work I use Shrink-O-Matic - it's an Adobe AIR app. You set the ratio or maximum height/width, the output folder and then just drag the photos in.

No idea how many photos it can do at a time but it works for me.
Logged
nop_90
Global Moderator
Lifer
*****
Offline Offline

Posts: 2203


View Profile
« Reply #10 on: May 15, 2009, 04:09:04 PM »

Yeah I'm not sure what rcjordan means when he differentiates between serverside or clientside image resizing. Why would you upload an image to a server just to resize it? PHP runs just fine on all my workstations.
For something like those adult friend finder ads.
Where u have a chick and then she holds out a sign, "I live in XXXXXXX"

Or maybe perks has a variety of images, and he is combining them together somehow using geo graphic location Smiley

Or maybe he has a bunch of images.
Then based on users bandwidth/screen size which he checks dynamically. He then sends that appropriate sized image at run time.
Lots of reasons Cheesy
Logged
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #11 on: May 15, 2009, 06:25:47 PM »

This is sort of a lifestyle issue. In the pro site development/management field (like here), I run into a few guys who work AT their *nix server, so little windows/mac apps aren't going to work for them.

Gotcha - that's me as well. Even though I'm at home on my Mac, I'm actually working downtown. That's where everything lives and runs.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #12 on: May 15, 2009, 06:26:57 PM »

For my resizing work I use Shrink-O-Matic - it's an Adobe AIR app. You set the ratio or maximum height/width, the output folder and then just drag the photos in.

No idea how many photos it can do at a time but it works for me.

Nice ehlo - thanks, I'll give it a look. If I can script Adobe (or some such) I think I may be better off, because I can push the process off to the artist, so she can do it as a matter of course during her development. Thanks!
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #13 on: May 15, 2009, 06:28:01 PM »

Or maybe perks has a variety of images, and he is combining them together somehow using geo graphic location Smiley

Would be great if it were something that exciting, alas, it is sexy men in underwear.
Lots and lots of underwear.

Revamp of an existing store.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
nop_90
Global Moderator
Lifer
*****
Offline Offline

Posts: 2203


View Profile
« Reply #14 on: May 15, 2009, 08:18:34 PM »

Would be great if it were something that exciting, alas, it is sexy men in underwear.
Lots and lots of underwear.

Revamp of an existing store.

Make a new line.
Where it has on the crotch something like "Suffield Rocks" or "Dundurn Rocks"
Based on geo location
Should be a good seller. The more of a butt fuk place it is the more pride people take in it
Logged
Pages: [1] 2
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!