CgJPEGFileFormat>formatMatchesByteStream: fails for JPG file

VA Smalltalk is a "100% VisualAge compatible" IDE that includes the original VisualAge technology and the popular VA Assist and WidgetKit add-ons.

Moderators: Eric Clayberg, wembley, tc, Diane Engles, solveig

CgJPEGFileFormat>formatMatchesByteStream: fails for JPG file

Postby PhotonDemon » Tue Apr 19, 2011 7:27 am


I'm trying to use CgFileFormat formatMatchingFile: aFilePath ifNone: [] to determine the CgImageFileFormat sub class to use to read an image file. When the image is a JPEG file, CgFileFormat>formatMatchingFile:ifNone: fails to fine the CgImageFileFormat sub class of CgJPEGFileFormat :( .

The problems seems to be in CgJPEGFileFormat>formatMatchesByteStream: at:

Code: Select all
   (appn verify and: [appn segmentMarker == APP0])
      ifFalse: noMatch.

The test for "appn segmentMarker == APP0" looks like the problem as APP0 is 16rFFE0 and the file contains 16rFFE1. The thing is I am able to read and display the file with CgJPEGFileFormat, just fine. Every jpg file I've tried fails the test but is able to be read and displayed.

Is this a bug or am I missing something?

sample jpg file
cold_love.jpg (2.27 KiB) Viewed 61 times
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
Posts: 176
Joined: Thu Dec 20, 2007 1:45 pm

Re: CgJPEGFileFormat>formatMatchesByteStream: fails for JPG

Postby marten » Tue Apr 19, 2011 10:11 am

And 16rFFE1 corresponds to APP1 - another subdefinition within the JPEG specification.

Perhaps you might read here ...

Marten Feldtmann, Principal Smalltalk User, Private
SkypeMe callto://marten.feldtmann
Posts: 641
Joined: Sat Oct 14, 2006 7:10 am
Location: Hamburg - Germany

Return to VA Smalltalk 7.0, 7.5 & 8.0

Who is online

Users browsing this forum: No registered users and 1 guest