We help IT Professionals succeed at work.

Resize images

mmcw
mmcw asked
on
282 Views
Last Modified: 2010-03-05
Hello,

I am working on a script that has ímages in it.
Now I want to make a start page where all images are listed as small images.
Standard the images are 200x200 picels.
On the starting page I want them to appear as 40x40 picels.
When I only reduce the width and high the image size in bytes will be as big as when I load the image 200x200.

Is there a way to resample the image to for example 40x40 using the original 200x200 picture!

I do not want to use a image editor, because it are a lot of images!!

greetings Michel
Comment
Watch Question

Remember programs like Photoshop have batch editing.  You set up an action like a resize (either by percent or to a fixed width/height) and then you select all the files to be "batch processed" or sent through the process.
Use like this:  

use Image::Magick;
  $p = new Image::Magick;
  $p->Read("imagefile");
  $p->Set(size=>'70x70');  
  $p->Write("filename");

Author

Commented:
It is not possible for me to install modules!!
Is there an other way??

greetings Michel
As far as I know, no.  The only other option is the batch process option of graphics progs like Photoshop...

If not try this Thubs Plus:

http://www.cerious.com/

ozo
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2015

Commented:
Is your start page an HTML page?

Author

Commented:
Answer to OZO,

Yes and NO.

Yes it is HTML but it is made by a script with output is a HTML page!
ozo
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2015

Commented:
then could the script just produce output with
<img  height=40 width=40>

Author

Commented:
Question to OZO;

Will the size of the file decrease when I enter a a lower value for the width and height of the image???

When the image is normaly 40 Kb in size and 200 x 200 picels width and height.
Will the size of the file decease if the width and height will be set to 40???

I have about 10 of those images on one page. When The file size will not decrease there has to be loaded more then 400 Kb of data before the complete page is to see!!

greetings Michel
No the file size will not descrease...

Author

Commented:
I can not install modules!!
OK try this though there are no guarentees... place the Magick.pm file in the same dir as the perl script try to use it and the change the sebang to read like this:

#!usr/bin/perl -I./

or


#!usr/local/bin/perl -I./

whichever correctly points to your perl.

This add ./ to the @INC array which tells where perl to look for modules.  Many modules do no need to be "installed".  They require no actual compilation and so there instalation is nothing more than placing the pm file in the standard locations for modules for that instalation of perl and then creating man pages.  You can use this trick for many many modules.  BUT if you see that a modules pre install "package contains file with the .c or .h extension you are most lickly out of lick as these are C files which will need to be complied.  I didn't see any of these for Magick so I think it will work... I think.  Let me know.
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.