Artifacts Gallery Guilds Search Wiki Login Register

Welcome, Guest. Please login or register. - Thinking of joining?
a Summer day - @700.30 (what is this?)
Activity rating: Four Stars Posts & Arts: 78/1k.beats Random | Recent Posts | Guild Recents
News: :ha: :pc: Hello Melonland! :pc: :happy: Guild Events: Summer Projects

+  MelonLand Forum
|-+  Life & The Web
| |-+  ✁ ∙ Web Crafting
| | |-+  bulk optimization of images for the web?


« previous next »
Pages: [1] Print Embed
Author Topic: bulk optimization of images for the web?  (Read 93 times)
ainoumi
Casual Poster ⚓︎
*
View Profile WWWArt


The Sea of Love
⛺︎ My Room
SpaceHey: Friend Me!
StatusCafe: ifelse95
iMood: ainoumi
XMPP: Chat!
RSS: RSS

Guild Memberships:
Artifacts:
Joined 2026!
« on: a Summer night » Embed

hi there,
i am currently in the midst of overhauling my site. current project regarding that is reimplementing my various art galleries.

at the moment, im hosting the images themselves offsite, and it works and all. except, my images are large, and take a little bit to load.

that being said, id like to modify the images directly to make them smaller in file size. of course, i would save the originals, and upload the optimized copies. issue is... i have a ton of images. id like to see if i can edit them in bulk.

what would be the best method to go about this? or is there something else i can do entirely? thank you in advance.

EDIT 2026-07-12 07:24:24:
i figured something out! thank you everyone for your input!  :4u:

« Last Edit: a Summer day by ainoumi » Logged

(They/them)
https://ainoumi.space/img/sol-button.gif
(my post font is so big due to my poor eyesight!)
sunnyp4rk
Sr. Member ⚓︎
****
View Profile WWWArt


NIKKI
⛺︎ My Room
XMPP: Chat!
RSS: RSS

Guild Memberships:
Artifacts:
MeowPawFang (Bat)Joined 2026!DSi
« Reply #1 on: a Summer night » Embed

I use this image compressor to compress images for my site. It's worked for me for about 2 years now.

Logged

*Nikki*

Artifact Swap: Harbor Mail
mrparker
Casual Poster ⚓︎
*
View Profile WWW

⛺︎ My Room

Guild Memberships:
Artifacts:
Joined 2026!
« Reply #2 on: a Summer night » Embed

A fully automated approach depends on your operating system, but for Linux and macOS (or Windows with WSL2) - you can write a script to iterate through a directory and use something like imagemagick to convert them to different formats, and set quality settings too.

So for example, in a directory of jpgs and convert them to webp, and compress them to 50% quality:

Code
#!/usr/bin/env bash

# Make sure you have image magick installed - it is available on Linux and macOS through brew.sh
# or your package manager 

ext=".jpg" # change this to the extension for the images you want to convert/compress
format=".webp" # change this if you want to change the format of the result image
quality=50 # change this to lower for higher compression, higher for less compression

# shouldn't need to change anything below
extLength=${#ext}

for file in ./*$ext; do
    fileWithoutExt=${file:0:-$extLength}
    echo "Compressing $file"
    magick $file -quality $quality $fileWithoutExt$format
done

Sometimes lower compression results in higher file sizes - to experiment more easily for what works best for those images, use the below tool.

If you ever find a need to compress one image instead of a directory, a useful tool is called Squoosh - made by Google for the purpose of optimizing images. The images are compressed locally on-device - they do not go to a server to be compressed, if you are concerned about privacy or potential for images to be used for training data.

The website is here

If smaller file sizes don't help - try re-locating your images closer to you physically - this could be done using a CDN like bunny.net, or just simply using a server physically closer to where you expect most of your traffic to come from.

If you really want to go crazy with it, make multiple sizes of the same image and serve those depending on the client - you can do that using the img HTML tag and the srcset property - and let the browser fetch which one is best for it: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/img#sizes

Edit:
While looking at your current website, some of the images are crazy large (over 1MB in size) - and aren't rendering visibly in the browser at those resolutions. This results in wasted bandwidth and time. I would highly recommend sizing the images physically to how they are visibly viewed in the browser. If an image is 400x400 but is rendered at 200x200 - scale the image to 200x200 instead of keeping it at 400x400 - that alone will net huge savings in size.

You can check what an image is being rendered at by right-clicking it and clicking "Inspect Element" in your browser, and looking at the overlay showing you the physical size of it in the viewport verses the resolution - that will give you a pretty exact idea as to how to size your images. Sometimes relying on the height and width properties isn't enough, cause ultimately those change the aspect ratio, too - not just the size.

Now, another trick to reduce what web developers call "jank" is to set the size properties ahead of time - this tells the browser to make space for those elements ahead of time, even as the image downloads. This will help a lot in preventing things from shifting around, and when you eventually optimize your images - makes the feeling of the site loading a lot faster even if it isn't.

Another trick is to lazy load images - this trick works best when used very sparingly. So, the idea is an image may not be needed immediately - cause it isn't visible immediately when the page loads. You have to scroll to see this image, or maybe you have to click something to show it. Lazy loading can help here - it lets the browser know which images don't need to be loaded immediately and can wait to be loaded later when more appropriate.

Adding the attribute loading and setting it to lazy to the img tag helps specifically with this.

Example:
Code
<img src="/some-awesome.jpg" loading="lazy" />

Now, what about the opposite - logos and things like that need to load immediately, right? Critical images in the content - such as maybe an image displaying the result of a recipe or something, most likely need to take priority over the other images on the page.

Just like with lazy loading, there's also one for priority images - you just have to change "lazy" to "eager" for those images.

With these tricks in tandem with compression will make your website significantly faster - as a lot of your images are over 100kb in size. It's literally free performance that you can get right now - no need to pay for a CDN or anything crazy like that.

Hopefully this helps!

« Last Edit: a Summer night by mrparker » Logged
ainoumi
Casual Poster ⚓︎
*
View Profile WWWArt


The Sea of Love
⛺︎ My Room
SpaceHey: Friend Me!
StatusCafe: ifelse95
iMood: ainoumi
XMPP: Chat!
RSS: RSS

Guild Memberships:
Artifacts:
Joined 2026!
« Reply #3 on: a Summer night » Embed

I use this image compressor to compress images for my site. It's worked for me for about 2 years now.

A fully automated approach depends on your operating system, but for Linux and macOS (or Windows with WSL2) - you can write a script to iterate through a directory and use something like imagemagick to convert them to different formats, and set quality settings too.

thank you both!! i will experiment with each of these methods!  :4u:
i shall report back on what worked out best.

EDIT:
Edit:
While looking at your current website, some of the images are crazy large (over 1MB in size) - and aren't rendering visibly in the browser at those resolutions. This results in wasted bandwidth and time. I would highly recommend sizing the images physically to how they are visibly viewed in the browser. If an image is 400x400 but is rendered at 200x200 - scale the image to 200x200 instead of keeping it at 400x400 - that alone will net huge savings in size.

i did kind of know of this already, but i thank you for putting it out there before me where it would fully register into my head. also, thank you for the advice. i think im going to give imagemagik a shot!

« Last Edit: a Summer night by ainoumi » Logged

(They/them)
https://ainoumi.space/img/sol-button.gif
(my post font is so big due to my poor eyesight!)
rolypolyphonic
Full Member ⚓︎
***
View Profile WWW


The Non-Living World's first and cutest prophet
⛺︎ My Room
StatusCafe: rolypolyphonic
Matrix: Chat!
XMPP: Chat!
Itch.io: My Games
RSS: RSS

Guild Memberships:
Artifacts:
Joined 2025!
« Reply #4 on: a Summer day » Embed

A lot of people don't like .WEBP but if you don't mind hosting your images in that format, it really makes a huge difference in keeping file sizes down. I use BIRME to mass-convert and resize images (although personally I find resizing them manually first then converting comes out with better quality) and set images at about 80-95% quality to keep things small.


Logged

https://breadavota.cafe/art/breadavotabutton.gifhttps://daydream.attorney/images/daydreamattorney_button.gifhttps://daydream.attorney/images/schizospec_button.png

My projects:

Bread, and all variations of the aforementioned - a hypertext multimedia webcomic series about a sentient Doll and the End of the World
Bien, and the Antivirus of the Apocalypse - novella about how an Undead Demon spent their Time [sic] in an underground bunker guided by the Voice of Reality after a metaphysical War
Daydream Attorney - a coagulation of spectres dedicated to turning schizotypy into the world's first viral mind disease
ainoumi
Casual Poster ⚓︎
*
View Profile WWWArt


The Sea of Love
⛺︎ My Room
SpaceHey: Friend Me!
StatusCafe: ifelse95
iMood: ainoumi
XMPP: Chat!
RSS: RSS

Guild Memberships:
Artifacts:
Joined 2026!
« Reply #5 on: a Summer day » Embed

A lot of people don't like .WEBP but if you don't mind hosting your images in that format, it really makes a huge difference in keeping file sizes down. I use BIRME to mass-convert and resize images (although personally I find resizing them manually first then converting comes out with better quality) and set images at about 80-95% quality to keep things small.

its funny you mention the general disliking of .WEBP, because thats actually what i ended up converting most of my main image assets to  :omg:
i used to dislike it myself, but after seeing how small my images turned out in file size, i figured maybe it wasnt so bad after all.

Logged

(They/them)
https://ainoumi.space/img/sol-button.gif
(my post font is so big due to my poor eyesight!)
Pages: [1] Print Embed 
« previous next »
 

Melonking.Net © Always and ever was! SMF 2.0.19 | SMF © 2021 | Privacy Notice | Send Feedback | Supporters ♥ Forum Guide | Rules | RSS | WAP | Mobile


MelonLand Badges and Other Melon Sites!

MelonLand Project! Visit the MelonLand Forum! Support the Forum
Visit Melonking.Net! Visit the Gif Gallery! Pixel Sea TamaNOTchi
MelonLand @000

Minecraft: Online
Join: craft.melonking.net