[Melbourne-pm] Image::Resize, avidemux and JPEG types

Andrew McN andrewmcnnz at gmail.com
Sat Feb 9 17:07:29 PST 2013


Googling this suggests that many other file recognition systems match on
"\377\330\377" and don't care about the next byte.

Not sure if it's recommended. Haven't found an authoritative reference.
On 10/02/2013 11:45 AM, "Leigh Sharpe" <leigh.sharpe at gmail.com> wrote:

> Hi All,
>  I've been using Image::Resize for a while, and it works a treat. But
> recently I've found that if I use avidemux to save a screenshot from a
> video as a JPEG, Image::Resize chokes on it.
>  The offending code is in this block in GD::Image :
>
> sub _image_type {
>   my $data = shift;
>   my $magic = substr($data,0,4);
>   return 'Png'  if $magic eq "\x89PNG";
>   return 'Jpeg' if $magic eq "\377\330\377\340";
>   return 'Jpeg' if $magic eq "\377\330\377\341";
>   return 'Jpeg' if $magic eq "\377\330\377\355";
>   return 'Jpeg' if $magic eq "\377\330\377\356";
>   return 'Gif'  if $magic eq "GIF8";
>   return 'Gd2'  if $magic eq "gd2\000";
>   return 'Xpm'  if substr($data,0,9) eq "/* XPM */";
>   return;
> }
>
>
> ...It turns out that my images all start with   \377\330\377\376
>
> The fix is as simple as adding another line to the sub above, to say:
>
>
>   return 'Jpeg' if $magic eq "\377\330\377\376";
>
>
> ..But I'm not sure just where the fault lies here. Should I submit a patch
> to the GD::Image maintainers? Or is this actually a bug in avidemux? Is the
> image being created by avidemux actually valid?
>
> Any ideas??
>
>
> ______________________________**_________________
> Melbourne-pm mailing list
> Melbourne-pm at pm.org
> http://mail.pm.org/mailman/**listinfo/melbourne-pm<http://mail.pm.org/mailman/listinfo/melbourne-pm>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/melbourne-pm/attachments/20130210/9298c904/attachment.html>


More information about the Melbourne-pm mailing list