Here is the fix: === Name: Zinc-HTTP-SvenVanCaekenberghe.450 Author: SvenVanCaekenberghe Time: 25 May 2016, 11:02:23.445172 am UUID: 2785db13-be7c-4ec1-86ce-ca8b4d58bae1 Ancestors: Zinc-HTTP-SvenVanCaekenberghe.449
Re-implement ZnEasy class >> #get[Png|Jpeg|Gif] so that ImageReadWriter decides on the parser to use by checking the magic header, instead of hardcoding a specific subclass. This was necessary because the plugin based JPEG parser was not being used, while it should. Add ZnEasyTests>>#testGetGif and #testGetPng === Name: Zinc-Tests-SvenVanCaekenberghe.237 Author: SvenVanCaekenberghe Time: 25 May 2016, 11:02:43.330855 am UUID: 4a6b5827-daf2-4ccf-b452-cf08e84feb9b Ancestors: Zinc-Tests-SvenVanCaekenberghe.236 Re-implement ZnEasy class >> #get[Png|Jpeg|Gif] so that ImageReadWriter decides on the parser to use by checking the magic header, instead of hardcoding a specific subclass. This was necessary because the plugin based JPEG parser was not being used, while it should. Add ZnEasyTests>>#testGetGif and #testGetPng === > On 24 May 2016, at 21:11, Sven Van Caekenberghe <[email protected]> wrote: > > >> On 24 May 2016, at 20:11, Peter Uhnák <[email protected]> wrote: >> >> >> >> On Tue, May 24, 2016 at 7:50 PM, Henrik Nergaard <[email protected]> >> wrote: >> Not sure where to report zinc bugs… fogzbugz? or is it a separate project? >> >> Any bug found in the standard image regardless of project should be reported >> on fogbugz, no? >> >> >> Ah, good point. >> >> >> >> >> but this works just fine… >> >> If I do: >> >> >> >> | imageStream | >> >> >> >> imageStream := (ZnEasy get: >> 'http://orig13.deviantart.net/e8d3/f/2013/092/a/3/glados_s_activation_by_first9-d605rwi.jpg') >> contents readStream. >> >> >> >> JPEGReadWriter formFromStream: imageStream. >> >> >> >> It will give me an error “image format not recognized”. >> >> >> >> ImageReadWriter chooses to use PluginBasedJPEGReadWriter instead of >> JPEGReadWriter (ImageReadWriter >>#readerClassFromStream: ). >> >> >> >> So perhaps #getJpeg: should use the PluginBasedJPEGReadWriter or have a >> fallback on error trying once more by using ( >> >> JPEGReadWriter formFromStream: theStream ) ? >> >> >> What's the difference? Why do we have two clasees for reading JPEGs? >> >> Peter > > One is implemented in pure Pharo code, the other is plugin based, C code > calling a library, and is much faster (and presumable more capable in > handling weird cases). > > I always assumed the fastest one was used automatically, but apparently not. > > This works: > > PluginBasedJPEGReadWriter formFromStream: (ZnEasy get: > 'http://orig13.deviantart.net/e8d3/f/2013/092/a/3/glados_s_activation_by_first9-d605rwi.jpg') > entity readStream. > > I'll have to look into this. > > Sven >
