<p dir="ltr">Googling this suggests that many other file recognition systems match on "\377\330\377" and don't care about the next byte. </p>
<p dir="ltr">Not sure if it's recommended. Haven't found an authoritative reference. </p>
<div class="gmail_quote">On 10/02/2013 11:45 AM, "Leigh Sharpe" <<a href="mailto:leigh.sharpe@gmail.com">leigh.sharpe@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi All,<br>
 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.<br>
 The offending code is in this block in GD::Image :<br>
<br>
sub _image_type {<br>
  my $data = shift;<br>
  my $magic = substr($data,0,4);<br>
  return 'Png'  if $magic eq "\x89PNG";<br>
  return 'Jpeg' if $magic eq "\377\330\377\340";<br>
  return 'Jpeg' if $magic eq "\377\330\377\341";<br>
  return 'Jpeg' if $magic eq "\377\330\377\355";<br>
  return 'Jpeg' if $magic eq "\377\330\377\356";<br>
  return 'Gif'  if $magic eq "GIF8";<br>
  return 'Gd2'  if $magic eq "gd2\000";<br>
  return 'Xpm'  if substr($data,0,9) eq "/* XPM */";<br>
  return;<br>
}<br>
<br>
<br>
...It turns out that my images all start with   \377\330\377\376<br>
<br>
The fix is as simple as adding another line to the sub above, to say:<br>
<br>
<br>
  return 'Jpeg' if $magic eq "\377\330\377\376";<br>
<br>
<br>
..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?<br>
<br>
Any ideas??<br>
<br>
<br>
______________________________<u></u>_________________<br>
Melbourne-pm mailing list<br>
<a href="mailto:Melbourne-pm@pm.org" target="_blank">Melbourne-pm@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/melbourne-pm" target="_blank">http://mail.pm.org/mailman/<u></u>listinfo/melbourne-pm</a><br>
</blockquote></div>