@foone
Oh yeah, I love GreenShot
I used to use Purrint for the longest time, but Win10 adds these huge margins around the windows. GreenShot gets proper pictures. Also scripting!
So I guess you're using Greenshot to grab the screenshot, and then it runs your pastejpeg program passing a path the the saved screenshot PNG to it? Then your pastejpeg probably replaces what's in the clipboard.
@foone Fun. After reading the first toots I was already wondering whether something like this would work on #X11 without much code. It actually does in a hackish way:
1. When the clipboard contains image/png data, fetch it with xclip
2. Use convert to get a JPG (or create lossy WebP or whatever)
3. Read that with xclip -t image/png
4. Paste it.
At least Firefox will get an image/png that is actually a JPEG data, the Mastodon client will send it as image/png and the server will interpret it as image/jpeg … xclip -t image/jpeg does not work and Chrome doesn't accept the invalid PNG, though.
CAN SEE BIRD
@foone
#!/bin/bash
for file in images_small/*.png; do
convert $file -resize 400x200 $file
done
I'm sure you can make a windows equivalent. On my mac, I have tied an image-editing script to Finder via Keyboard Maestro, so I can click a file to automate the processing.
@foone doesn't PNG support similar compression like JPEG does? Maybe it just needs to be tickled that way / resized?
Asking since I *think* PNG is supposed to be a newer and better format, but I very well may be mistaken.
@viq no, the compression is completely different, both in effect and idea
The compression in PNG is lossless, like a ZIP (in fact, it uses the same compression algorithm as ZIP files, DEFLATE). You always get the same pixels out that you put in. Downside: you generally can't compress *too* much, and it doesn't really work for photographs, because even you have a picture of a white wall, it's not all the exact same white everywhere, unlike in digital drawings
@viq JPEG, on the other hand, is lossy. By creating a JPEG, you lose information you can't get back
The compression is complex-ish, based on the direct cosine transform, which works similar to a fourier transform, i.e. it analyzes the frequency components and then throws away subtle changes in the pixels you're not likely to notice
Work great for photos, because, like I said, in the natural world, white isn't pure #000000
@viq But doesn't work well for anything with hard edges like digital drawings, comics, text, and also screenshot. You get "artifacts" around those, ringing. You might have seen those on badly compressed JPEGs of screenshots with text
For something here on social media, foone doesn't seem to care that much to get 100% pristine images, tho
And depending on the quality setting, how much it's compressed and how much you look for it, it might not be that noticable
@viq so it's not necessarily important that PNG is newer than JPEG, it's more that they solve different problems. They target different use cases
Roughly:
- JPEGs are for photos of the real world, with its impressions
- PNGs are for digital drawings, where you have hard edges, areas of exactly the same color, that sort of thing. Where it's important that what you put it is what you get out again