03-21-2022, 08:30 PM | #1 |
Enthusiast
Posts: 28
Karma: 10
Join Date: May 2009
Device: BeBook (2009), Kobo Clara HD (2018), Kobo Libra 2 (2022)
|
PNG to JPG
Sometimes ebooks will be embiggened with large PNG images of photos which should have been much smaller JPGs
The Calibre editor built-in "compress image" tool does not offer that conversion, and it seems to me, after some search, that no plug-in does it either. I would not mind at all being corrected on this |
03-26-2022, 12:06 AM | #2 | |
Grand Sorcerer
Posts: 5,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
Shameless plug: I created a Sigil plugin for lossy (and lossless) .png optimization that uses pngquant for lossy optimization. |
|
Advert | |
|
03-26-2022, 08:41 AM | #3 | |
Guru
Posts: 919
Karma: 417282
Join Date: Jun 2015
Device: kobo aura h2o, kobo forma
|
Quote:
JPG is generally lower quality. A PNG of the same quality as the JPG likely would be smaller than the JPG. |
|
03-26-2022, 11:39 AM | #4 |
Addict
Posts: 387
Karma: 1638210
Join Date: May 2013
Location: Ontario, Canada
Device: Kindle KB, Oasis, Pop_Os!, Jutoh, Kobo Forma
|
I often see this. Given the quality of images on an e-ink reader, I don't care much about absolute image quality. On the Kindle or Kobo I usually can't tell the difference after I seriously change and compress images. I use ImagMagick from the command line:
1. Open the book in the editor, export all the png images to a working directory. 2. In that directory, run mogrify -format jpg *.png from a terminal, of course ImageMagick has to be installed. 3. Back in the editor, delete all the png files and import all the jpg files you made 4. In search & replace, look for .png and replace with .jpg in all text files 5. Run compress images lossily at a factor of 50. That actually takes only a minute or two after you have done it a couple of times. When you are dealing with 40 or 50 or more images, it saves hours compared to one-by-one processing. |
03-26-2022, 01:36 PM | #5 |
Custom User Title
Posts: 8,608
Karma: 61176603
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
JPG also doesn't support transparency if that's important to you. (JPEG2000 does -- shame it isn't more widely used.)
|
Advert | |
|
03-27-2022, 05:57 AM | #6 |
the rook, bossing Never.
Posts: 11,154
Karma: 85874891
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
|
Most ereaders don't support PNG Transparency and dark mode can be a problem.
Line art, graphic presentations & some non-photographic images can look worse in JPG or even in extreme cases be larger. But natural images can look fine in jpeg with a big file space saving. Transparency is for fancy websites, or multimedia or apps. It should usually be replaced by white for images to be used on paper or in real eBooks. |
03-27-2022, 08:45 PM | #7 | |
Enthusiast
Posts: 28
Karma: 10
Join Date: May 2009
Device: BeBook (2009), Kobo Clara HD (2018), Kobo Libra 2 (2022)
|
Quote:
Step 3 is the key, hadn't thought of that. Replacing manually each one of a few dozen images in a particular large book tripped my lazyness threshold Many thanks. |
|
03-27-2022, 08:57 PM | #8 |
Enthusiast
Posts: 28
Karma: 10
Join Date: May 2009
Device: BeBook (2009), Kobo Clara HD (2018), Kobo Libra 2 (2022)
|
Thanks also to those who mentioned the quality and transparency issues, but that's not at play in the case that made me post.
It's particularly egregious, there's a bunch of photos as pngs, and to add insult to injury, they are shown on page smaller than original size ... |
03-28-2022, 07:45 AM | #9 | |
the rook, bossing Never.
Posts: 11,154
Karma: 85874891
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
|
Quote:
|
|
03-30-2022, 10:28 AM | #10 |
Enthusiast
Posts: 28
Karma: 10
Join Date: May 2009
Device: BeBook (2009), Kobo Clara HD (2018), Kobo Libra 2 (2022)
|
Just to confirm that retiredbiker's kindly provided recipe works flawlessly.
I managed to create a snag - the png photos were dumped in a folder three deep (hmtl?/?/images), and I imported the jpegs back directly, instead of in a folder. Being lazy, I just fixed the paths by replacing prefix strings, after doing the same for the file extensions. |
10-04-2022, 04:46 PM | #11 | |
Zealot
Posts: 126
Karma: 10
Join Date: Nov 2021
Device: Kobo Libra 2
|
Quote:
"'mogrify' is not recognized as an internal or external command, I've got ImageMagick installed, but obviously there's something I'm missing... Any tips gratefully received.
operable program or batch file." |
|
10-04-2022, 06:04 PM | #12 | |
Addict
Posts: 387
Karma: 1638210
Join Date: May 2013
Location: Ontario, Canada
Device: Kindle KB, Oasis, Pop_Os!, Jutoh, Kobo Forma
|
Quote:
:~$ which mogrify and see if you get /usr/bin/mogrify I'm no expert but ImageMagick is a complex beastie and as I recall I had to mess with it for a while to get it working a few years ago, but I can't recall what it needed. The OS forums are your friends here! |
|
10-04-2022, 07:39 PM | #13 |
Zealot
Posts: 126
Karma: 10
Join Date: Nov 2021
Device: Kobo Libra 2
|
Actually I worked out the problem from a youtube video, which told me to use:
"magick mogrify... [etc.]" rather than starting with "mogrify". That worked.Trouble is, I have another problem now. I've created a new thread about it, here: https://www.mobileread.com/forums/sh...62#post4263062 I'd certainly be grateful if you could offer any further advice... |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Convert epup3 pages to consecutive image file(JPG,PNG...) | tai0909 | ePub | 5 | 10-14-2019 05:19 AM |
KindleGallery: a nice png/jpg image viewer for Paperwhite (1 & 2) and Touch | Aeris | Kindle Developer's Corner | 4 | 11-04-2013 11:36 AM |
Replace all jpg with png with transparent background? | Claghorn | Recipes | 0 | 08-16-2012 12:14 PM |
Touch Converting multiple .jpg/.png into ePub for Manga | Gater | Kobo Reader | 11 | 01-08-2012 07:28 AM |