I’ve searched around and can’t find this but it seems like someone must have created this already. I am hoping to find a self-hosted image resizer app. I frequently need to take photos from my phone (etc…) and make them small enough to post online.
For instance, my lemmy instance (lemm.ee) only allows images in posts if they are smaller than 500KB but my phone’s photos are always larger than that.
In a perfect world, I could just browse to a local server app, upload an image, select a size to resize it to, hit Go and then download the smaller image. It doesn’t have to allow any other editing and it shouldn’t store images long-term. I want to self-host so I don’t have to upload my images to random web sites I know nothing about.
I would be happy with a FOSS desktop app I can install in linux too, but then I couldn’t access it from my phone. The Android apps I found for this either look scammy or include tons of ads.
Anyone know of such a thing? Thanks!
For your phone, use a native app, like Image Toolbox. It has a lot of functions, two of which are resize-by-dimensions, and filesize.
For the desktop… GraphicsMagick? Unless you need a GUI, in which case either whatever graphics tools come with Gnome of KDE should do the job.
It’s not a self-hosted but I think that Image Toolbox (https://f-droid.org/packages/ru.tech.imageresizershrinker/) meets your requirements
IT-tools has an image resizer: https://github.com/sharevb/it-tools (this is a fork of the original, not sure if the original has the same tool, but in any case this fork is way ahead)
https://github.com/T8RIN/ImageResizer
Image toolbox on Android is phenomenal.
Does exactly what you needs, and a tonne more.
Do you use a gallery app you like? I’m kind of sick of Google photos. I always have to “save a copy” when editing and it also separates my photos in a dumb way.
I’d like something simple that isn’t trying to sell me something (storage)
The Fossify one is decent
Thanks for showing me this I didn’t know fossify existed
Actually perfect no fancy add ons just pics!
I’m having an issue when viewing videos with it though - for some reason it won’t let me set fossify gallery as the default video viewer so everytime I have to click it after clicking on a video. Do you know how to set the default video app to fossify?
I thought it might be in settings but I don’t see it. For me, I got an option for “just this one” vs “always” when I tried to open a video, and it seems to be remembering that.
You could try backing up any settings and resetting the app to see if you get anything different, although it really should let you pick a default at any point
I figured it out thanks! For some reason I had to restart my phone and it finally worked.
At first it wouldn’t update to fossify when I tried, so everytime it would only give me the everytime/just this once toggle for Google photos.
Am I showing my age if I suggest ImageMagick?
With a little fucking around I’m fairly sure you could do it on the phone itself via termux.
Was thinking the same and you can.
Minimal fucking around needed too, just pkg install imagemagick then navigate filesystem to images ya want to adjust and magick however desired to reduce the file size.
And building a simple web page around that would be a few dozen lines of Python. NBD.
I recently saw a self-hosted imgix/cloudinary alternative. I thought I starred it on gh, but apparently not and I can’t remember the name.
Edit
I think this was it:
https://github.com/imgproxy/imgproxyBut also, on a second read of your post, I now realize what you are looking for is right here:
https://squoosh.app/It’s open source and it’s entirely client-side. It allows you to customize the settings to compress your image to the file size and format you need and maintain as much as the quality as possible. I can’t think of a simpler solution that works across all your devices.
what you are looking for is right here: https://squoosh.app/
That’s a fantastic name for a project.
I would be happy with a FOSS desktop app I can install in linux too
On the command line, you can do this with ImageMagick (e.g. use the command
convert
once it’s installed).With a (desktop) GUI, there’s a bunch of programs. GIMP is probably the most well known and has a ton of capabilities but is a bit complex. I use Kolourpaint as a quick-and-dirty “MS Paint”-like program for very simple tasks where I want a GUI.
If you want a simple web UI I’m sure there is one already, but I don’t know one specifically. It wouldn’t be too complicated to hack something up if all you need is a quick-and-dirty file input and percentage rescale or something like that. If you don’t get a better suggestion and don’t know how to make something like that yourself, let me know and I can write an example.
Yah, thanks. In a pinch, I’ve been using GIMP but as you say, there’s a lot to it and a lot of steps to this simple process.
I’m going to see if a AI tool can help hack together a simple web page. If I do, I’ll share the code I end up with somewhere.
You should really just do this without any web application. Just use a background shell script that does the resizing automatically on any image file that you dump into a certain folder. I have similar stuff set up for naming and sorting based on geo location data.
You can even make this work for mobile by having the folder that the script runs on synced to your phone. You take a pic on your phone, it gets synced to your desktop, converted by the script, synced back to your phone.
This way it also works if you want to share large amount of photos (of a trip or event or something)
Thanks for the script approach idea!
Two quick ideas on possible approaches:
-
Static page route. You can just write some Javascript to load the image from a file input in HTML, draw it resized to a canvas (based on an input slider or other input element), then save the canvas to an image. (There might even be simpler approaches if I wasn’t stupidly tired right now…) This can be done in a single file (HTML with embedded JS – and CSS if you want to style it a little) that you toss on any web server anywhere (e.g. Apache, nginx, whatever). Should work for JPEG, PNG, and probably WebP – maybe other regular image types too. Benefit: data never needs to leave your device.
-
Process on server route. Use Python with a simple web server library (I usually opt for tornado for stuff like this, but flask or cherrypy or similar would probably work). Set up a handler for e.g. an HTTP POST and either pass the image into a library like Pillow to resize it or shell out to ImageMagick as others have suggested. (If you want to do something clever with animated GIFs you could shell out to ffmpeg, but that’d be a fair bit trickier…) The image can be sent back as the response. Be careful about security if you take this route. Probably want some kind of login in front of it, and run it in a VM or some other secure environment – especially if you’re using AI to kludge it together…
Best of luck and let me know if you need any help. Will probably have some time this weekend if you can’t get it on your own. Happy hacking!
-