[Toybox] [PATCH] file: parse JPEG files enough to pull out their size in pixels.

enh enh at google.com
Tue Jan 2 17:23:55 PST 2024


On Tue, Dec 19, 2023 at 5:51 PM scsijon <scsijon at lamiaworks.com> wrote:
>
>
> On 19/12/23 08:05, toybox-request at 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 <enh at google.com>
> > To: toybox <toybox at lists.landley.net>
> > Subject: [Toybox] [PATCH] file: parse JPEG files enough to pull out
> >       their size in pixels.
> > Message-ID:
> >       <CAJgzZoqp8f72kiX2R5okCURLhnS9tJysURiugmk7irX7VAp3RA at 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 :-)

> >   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 and merry christmas to all
>
> scsijon
>
> _______________________________________________
> Toybox mailing list
> Toybox at lists.landley.net
> http://lists.landley.net/listinfo.cgi/toybox-landley.net


More information about the Toybox mailing list