On 3/1/24 12:23, enh wrote:
On Tue, Dec 19, 2023 at 5:51 PM scsijon <scsi...@lamiaworks.com> wrote:

On 19/12/23 08:05, toybox-requ...@lists.landley.net wrote:
     1. [PATCH] file: parse JPEG files enough to pull out their size
        in pixels. (enh)
----------------------------------------------------------------------

Message: 1
Date: Sun, 17 Dec 2023 16:26:56 -0800
From: enh <e...@google.com>
To: toybox <toybox@lists.landley.net>
Subject: [Toybox] [PATCH] file: parse JPEG files enough to pull out
       their size in pixels.
Message-ID:
       <cajgzzoqp8f72kix2r5okcurlhns9tjysuriugmk7irx7vap...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

This doesn't handle refilling toybuf in the case where there's so
much EXIF data before the header we're looking for that we hit the
end of toybuf first. (In part because I couldn't decide whether to
do that or switch to a scheme where we only ever lseek() around,
reading big-endian shorts.)
---
Just wondering if this is going to work with compressed JPEG files or
are you going to see the compressed size instead?
it's the size in _pixels_, so compression isn't relevant.

if you mean "is this the _thumbnail_ size or the full image size?",
no, this is the full image size. tbh, before reading the JFIF spec to
implement this change, i had no idea that jpeg files could contain a
thumbnail! i have no such jpegs on my system, so (a) nothing to test
with and therefore (b) no obvious reason to bother to implement that
functionality :-)

Thank you for clearing that up for me.

Also a single jpeg can contain a number of thumbnail images in a single full size jpeg image, there are a number of photo storage applications (mainly professional and costly) that do this instead of just the thumbnail in the matching full sized image, so you get a set of full images with the added thumbnail inside the image plus a single jpeg containing thumbnails of all in the set, just to make things more difficult.

   toys/posix/file.c | 20 +++++++++++++++++---
   1 file changed, 17 insertions(+), 3 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-file-parse-JPEG-files-enough-to-pull-out-their-size-.patch
Type: application/octet-stream
Size: 2033 bytes
Desc: not available
URL: 
<http://lists.landley.net/pipermail/toybox-landley.net/attachments/20231217/a22282b7/attachment-0001.obj>

------------------------------

regards

scsijon

_______________________________________________
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to