Are JPEG images not permitted in ePub ebooks ?

1,969 views
Skip to first unread message

booklover88

unread,
Jan 27, 2009, 1:27:55 PM1/27/09
to epubcheck
Hello,

I've just moments ago created my first fully validated ePub ebook, by
hand coding -- so you can see that I'm a beginner here.

At first, everything validated except one error message that said:

"non-standard image file"

I have only one image in the ebook -- the JPEG book cover. I coverted
the JPEG to a PNG, changed things in the contents.opf file, and then
re-submitted the file for validation.

And then it validated perfectly.

So which is correct:
A. JPEG images are not permitted in ePub ebooks; or
B. The validator, in rejecting the JPEG, needs a little tweak ?

Thanks again ...

Dave Cramer

unread,
Jan 27, 2009, 1:34:29 PM1/27/09
to epub...@googlegroups.com
JPEGs are fine; I've used them in 2,000 or so ePubs, and ePubCheck has
never complained. Perhaps the image is corrupt, or it's in some weird
color space or is in some other way non-standard...

Dave
--
Dave Cramer
Technical Lead
TexTech, Inc.
70 Landmark Hill Drive
Brattleboro, VT 05301
802.254.6073 x127
d.cr...@textechinc.us

Sanjib Kumar Das

unread,
Jan 27, 2009, 1:35:56 PM1/27/09
to epub...@googlegroups.com
Hello Jon,
 
A. JPEG images are not permitted in ePub ebooks; (JPEG images are supported in ePub ouput).
 
Thanks
Sanjib

Jon

unread,
Jan 27, 2009, 1:46:23 PM1/27/09
to epubcheck
Sanjib Kumar Das wrote:

> A. JPEG images are not permitted in ePub ebooks; (JPEG images are supported
> in ePub ouput).

I'm not sure what Sanjib means by this, but when in doubt about
whether ePub
supports or does not support something, go to the specs!

With regard to support for JPEG, refer here:

http://www.idpf.org/2007/ops/OPS_2.0_final_spec.html#Section1.3.7

JPEG, GIF, and PNG are supported raster image formats, and all OPS
Reading
Systems (read "ePub Reading Systems") MUST support these image
formats.

Again, I cannot stress how important it is for those who build ePub
Publications to
read and understand the specs! ePub is defined by three specs:

OPS: http://www.idpf.org/2007/ops/OPS_2.0_final_spec.html
OPF: http://www.idpf.org/2007/opf/OPF_2.0_final_spec.html
OCF: http://www.idpf.org/ocf/ocf1.0/download/ocf10.htm

Jon Noring

garth...@gmail.com

unread,
Jan 27, 2009, 1:46:33 PM1/27/09
to epubcheck
JPEG is a core supported media type -- from the Spec:

The OPS Core Media Types are:

MIME Media Type
Reference
Description
image/gif http://www.w3.org/Graphics/GIF/spec-gif89a.txt
Used for raster graphics
image/jpeg http://www.w3.org/Graphics/JPEG/
Used for raster graphics
image/png RFC
2083
Used for raster graphics

booklover88

unread,
Jan 27, 2009, 1:58:48 PM1/27/09
to epubcheck
Thanks, everyone -- there's a lot of useful information in your
replies.

I did decide to go with the PNG format, since that was easier than to
figure out what was wrong with my JPEG file.

The Stanza desktop reader showed both image formats (and both variants
of my epub ebook: the one that validated with PNG, and the one that
did not with the JPEG) without a problem.

--booklover

Paul Norton

unread,
Jan 27, 2009, 8:43:43 PM1/27/09
to epubcheck
Is the media type right in the manifest?
If it isn't image/jpeg then epubcheck isn't going to recognize it as a
jpeg... :)

Paul

booklover88

unread,
Jan 27, 2009, 10:05:01 PM1/27/09
to epubcheck
Thanks, good thought -- but I also thought of that.
It was originally set to image/jpeg with a jpeg file as the cover.
When that flunked the epub validation, I changed my jpeg image file to
png, and also changed the media type to image/png.

Is there any information on what kind of jpeg files pass and what kind
fail ?
Or what kind are allowed in the specifications?
The aspect ratio is one factor, but there must others.

garth...@gmail.com

unread,
Jan 27, 2009, 10:19:24 PM1/27/09
to epubcheck
There is no "looking in" the JPEG that the validator does -- it really
is pretty just checking the MIME type in the OPF. No issues with
complexity/size/aspect-ratio of the image itself.

If you want to post the failing EPUB, I bet somebody (perhaps even me)
would take a look.

Robin Whitman

unread,
Jan 28, 2009, 9:34:45 AM1/28/09
to epub...@googlegroups.com
First, perhaps I should say that this ebook has just been posted for
sale, for one dollar -- so your advice here is ultimately assisting a
commercial venture, albeit a very very small one. This ebook is a test
of the format for me, an experiment to see if I'm comfortable with an
open format (ePub) without any DRM.

Here's the failed ePub ... I could not find the very latest failure,
but here's one with just 6 errors (the first 5, forgetting to close
some tags), and the last error is:

ERROR: trash-cj-024-002.epub/OPS/000a-cover.html(12): non-standard
image resource 'OPS/images/cover.jpg' of type 'image/jpg'

I fixed the 5 preceeding xhtml mistakes, and then switched image types
(I changed the book's cover file from cover.jpg to cover.png), and
also made the appropriate change in an .opf file, and then the new
ePub ebook validated without any errors.

But here's epub with the JPEG error:
this is download from Box.net, guaranteed to contain safe files,
nothing that will harm you or your computer, except a few atrocious
puns:

http://www.box.net/shared/3qn1eha927

thanks again ...
--
Best wishes,

Robin Whitman, Student Intern
Youthtopia.Org | Towards A Sustainable Lifestyle
http://www.Youthtopia.org

Peter Sorotokin

unread,
Jan 28, 2009, 9:45:14 AM1/28/09
to epub...@googlegroups.com
I think proper mimetype is image/jpeg, not image/jpg.

Peter

Robin Whitman

unread,
Jan 28, 2009, 10:01:21 AM1/28/09
to epub...@googlegroups.com
I looked in the file and behold and lo -- I did have image/jpg instead
of image/jpeg

Thanks, Peter!
Reply all
Reply to author
Forward
0 new messages