Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1377
  • Last Modified:

Image Resizing without image quality loss

One of my clients is currently using LWP:UserAgent to fetch HTML from another site.  He's having a problem because the image is too large for his site.  When we change the HTML to reduce the size of the image the quality stinks.  Is there a way to do this.  Maybe with an external script that would fetch the image and automatically reduce it?  I guess an example would be like:

<img src=http://www.domain.com/reducer.cgi?image=http://www.otherdomain.com/image.gif>
0
acdesigns
Asked:
acdesigns
1 Solution
 
ahoffmannCommented:
wget -O - http://www.otherdomain.com/image.gif | gifresize
0
 
TintinCommented:
If you have ImageMagik installed, you can do the whole lot in Perl (if you want to).

However, I am curious that you save you change the HTML to reduce the size of the image and the "quality stinks".   By that I'm assuming you are adjusting the height and width values in the <img src..> tag?  If so, if you are reducing the size, there should be no loss of quality so long as you retain the same aspect ratio.
0
 
rkosaiCommented:
The image should not lose quality as long as the aspect ratio as maintained, as Tintin stated.

This means that if you have a 800x600 picture, then you could resize it to an 8x6 picture, or a 160x120 picture, or anything where the width/height ratio is the same.  But you couldn't resize it to something like 8x7 or 160x150 without making the graphic look bad.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now