Compressing image files on the server (probably Imagemagick)
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Compressing image files on the server (probably Imagemagick)
I am fairly new to Linux and I've never used Imagemagick directly, and I am wondering if it will make sense to compress or resize images on a Linux system / server with this program.
I am importing around 10,000 picture galleries to the server (it may be less than that, this does not matter anyway) and they will be assigned to separate folders like
/contents/albums/main/200x150/3000/3001
10+ image files will be here, and like I said, I will have like 5,000 or more.
I was wondering if it will be fairly easy to do compressing and possible resizing with Imagemagick or would it be better to do it by hand on Windows, one by one (this may take a lot of time).
I am familiar with Linux, so I can take this path, but I am not sure whether it will be a good and possible thing to do.
1) Import all picture galleries to the server
2) Find folders which are the largest the size, above a certain acceptable level
3) Then I would need to look at these pictures, get familiar with what it is
4) Test different settings that would be the best
5) Run some kind of compressing (and possibly resizing, but not likely) commands in bulk on these files
I guess it is all possible, and when I look at the list of galleries (it is actually around 5,000), it does not make sense to be doing it by hand (checking every url manualy, looking at the images / sizes, and so on).
There may be other ways of doing this too, but I am not sure. Like some kind of software or some kind of feature or addon to Photoshop. Generally 5,000 image galleries with 15 images each, and not all of them are of the same size (galleries start in year 2008 and the latest one has been added now, 2016), and they are not published in the same way.
I'm no expert but ImageMagick has various commands. The mogrify command it comes with allows for resizing (which I've done) and compression (which I've not). This can be run from command line so can be scripted. You could also script size comparisons. Scripting review of the ones above a certain size might be trickier as that would require a display to see the pictures rather than just command line.
Most picture formats are already compressed, don't expect any further compression.
Galleries start from year 2008 and are getting added until now, 2016. Image sizes in the oldest ones are around 150KB and thats ok, and the newer ones have sizes of around 500KB, which is too big. It is around 5,000 galleries, and a total of around 75,000 images, so this adds up. I am also asking about it on non-Linux forums, general webmaster ones, and I will see what info I can get from there. Linux can be good, as long as Imagemagick is not bad for this. There is a lot of Windows software for it too, and if I would like to download images to separate folders I would need to pay for a program which does it, and this costs around $40 (the only one good for it, I think). Then it takes work to do everything manually, and import images to the script in less automatic way.
Overall, I want to do it good. It is a good site that I am working on and if everything goes as planned it will be a high traffic site. I will have more galleries like this too, from other places, so a good method of doing this, would be very good.
While its true normal compression tools like gzip won't do much to a picture file the mogrify command will let you change things related to pixes with the -compress flag and the the quality (which affects how much detail and presumably the size in bytes) it stores with the -quality flag.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.