Image format not recognized

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

Image format not recognized

HilaireFernandes
Hi,

Anyone knows why the former code snippet fail but the later deprecated
one succeed?

PNGReadWriter formFromStream:
('/home/hilaire/Travaux/Developpement/DrGeoII/Dev-pharo7/drgeo/build/examples/wheel.png'
asFileReference binaryReadStream).

PNGReadWriter formFromStream: (FileStream
readOnlyFileNamed:'/home/hilaire/Travaux/Developpement/DrGeoII/Dev-pharo7/drgeo/build/examples/wheel.png'
).

Thanks

Hilaire

--
Dr. Geo
http://drgeo.eu


wheel.png (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Image format not recognized

Sven Van Caekenberghe-2
Hmm, works for me:


Pharo 7.0
Build information: Pharo-7.0+alpha.build.981.sha.5c76a586939f4336b1d3f4f3d47dfecdde90058e (64 Bit)

On 31 May 2018, at 11:23, Hilaire <[hidden email]> wrote:

Hi,

Anyone knows why the former code snippet fail but the later deprecated one succeed?

PNGReadWriter formFromStream: ('/home/hilaire/Travaux/Developpement/DrGeoII/Dev-pharo7/drgeo/build/examples/wheel.png' asFileReference binaryReadStream).

PNGReadWriter formFromStream: (FileStream readOnlyFileNamed:'/home/hilaire/Travaux/Developpement/DrGeoII/Dev-pharo7/drgeo/build/examples/wheel.png' ).

Thanks

Hilaire

-- 
Dr. Geo
http://drgeo.eu

<wheel.png>

Reply | Threaded
Open this post in threaded view
|

Re: Image format not recognized

HilaireFernandes
Ah, indeed testing on latest P7, this code works.

Oh, but wait PNG reader seems to break now on another part... See
screenshot.

Oh, it looks like the problem we got almost one years ago... where I
suggested code snipped for test inclusion[1] and it now fails again (was
not failing on my previous P7 image)... As far as I can see I did not
find a test based on it in the Pharo image I tested on.

At the time it was failing on 64bits, and now it fails on the 32bits I
tried it.

I guess some recent changes on P7 break something. It will be nice to
add a test based on the example I provided at [1].


Hilaire

[1]
http://forum.world.st/Regression-with-PNGReaderWriter-in-P6-td4951796.html


Le 31/05/2018 à 12:20, Sven Van Caekenberghe a écrit :
> Hmm, works for me:
>

--
Dr. Geo
http://drgeo.eu


brokenPNG.png (7K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Image format not recognized

Sven Van Caekenberghe-2
Hi Hilaire,

On Pharo 7 build 993 it works on both 32 and 64 bits (macOS):




The patch (#normalize calls here and there) seems to have been integrated as well your test case (#testNewFromSampleBytes), with your name in the comments !

Sven

On 31 May 2018, at 13:23, Hilaire <[hidden email]> wrote:

Ah, indeed testing on latest P7, this code works.

Oh, but wait PNG reader seems to break now on another part... See screenshot.

Oh, it looks like the problem we got almost one years ago... where I suggested code snipped for test inclusion[1] and it now fails again (was not failing on my previous P7 image)... As far as I can see I did not find a test based on it in the Pharo image I tested on.

At the time it was failing on 64bits, and now it fails on the 32bits I tried it.

I guess some recent changes on P7 break something. It will be nice to add a test based on the example I provided at [1].


Hilaire

[1] http://forum.world.st/Regression-with-PNGReaderWriter-in-P6-td4951796.html


Le 31/05/2018 à 12:20, Sven Van Caekenberghe a écrit :
Hmm, works for me:


-- 
Dr. Geo
http://drgeo.eu

<brokenPNG.png>

Reply | Threaded
Open this post in threaded view
|

Re: Image format not recognized

Sven Van Caekenberghe-2
In reply to this post by HilaireFernandes
Hi Hilaire,

On Pharo 7 build 993 it works on both 32 and 64 bits (macOS):




The patch (#normalize calls here and there) seems to have been integrated as well your test case (#testNewFromSampleBytes), with your name in the comments !

Sven

On 31 May 2018, at 13:23, Hilaire <[hidden email]> wrote:

Ah, indeed testing on latest P7, this code works.

Oh, but wait PNG reader seems to break now on another part... See screenshot.

Oh, it looks like the problem we got almost one years ago... where I suggested code snipped for test inclusion[1] and it now fails again (was not failing on my previous P7 image)... As far as I can see I did not find a test based on it in the Pharo image I tested on.

At the time it was failing on 64bits, and now it fails on the 32bits I tried it.

I guess some recent changes on P7 break something. It will be nice to add a test based on the example I provided at [1].


Hilaire

[1] http://forum.world.st/Regression-with-PNGReaderWriter-in-P6-td4951796.html


Le 31/05/2018 à 12:20, Sven Van Caekenberghe a écrit :
Hmm, works for me:


-- 
Dr. Geo
http://drgeo.eu

<brokenPNG.png>

Reply | Threaded
Open this post in threaded view
|

Re: Image format not recognized

HilaireFernandes
Hi Sven,

Thanks for your in-depth testing.

The code of the test and the one I posted last year is not the exactly
same. And if you try it, it fails. May be a supplementary source of failure.

Now with the latest P7 image of today, installing DrGeo fails.

Particularly this enclosed class fails to initialize. It comes with PNG
content as ByteArray. I think it is related problems.

It seem there are different syntax changes I don't understand:

This code fails NOW:

PNGReadWriter createAFormFrom: #(137 ... 130) asByteArray

This code succeeds:

PNGReadWriter formFromStream: #[137 ... 130] readStream


Is it expected failure?


Hilaire


Le 31/05/2018 à 16:23, Sven Van Caekenberghe a écrit :

> Hi Hilaire,
>
> On Pharo 7 build 993 it works on both 32 and 64 bits (macOS):
>
>
>
>
> The patch (#normalize calls here and there) seems to have been
> integrated as well your test case (#testNewFromSampleBytes), with your
> name in the comments !
>
--
Dr. Geo
http://drgeo.eu


DrGLoader.st.zip (9K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Image format not recognized

Sven Van Caekenberghe-2


> On 31 May 2018, at 17:55, Hilaire <[hidden email]> wrote:
>
> Hi Sven,
>
> Thanks for your in-depth testing.
>
> The code of the test and the one I posted last year is not the exactly same. And if you try it, it fails. May be a supplementary source of failure.
>
> Now with the latest P7 image of today, installing DrGeo fails.
>
> Particularly this enclosed class fails to initialize. It comes with PNG content as ByteArray. I think it is related problems.
>
> It seem there are different syntax changes I don't understand:
>
> This code fails NOW:
>
> PNGReadWriter createAFormFrom: #(137 ... 130) asByteArray
>
> This code succeeds:
>
> PNGReadWriter formFromStream: #[137 ... 130] readStream
>
>
> Is it expected failure?

That is because that particular method (with no users in the image) uses a deprecated class, change it to the simpler

createAFormFrom: data
        | error f |
        error := ''.
        f := [ self formFromStream: data readStream ] ifError:
                [ :a :b |
                error := a printString , '  ' , b printString.
                (StringMorph contents: error)
                        color: Color red;
                        imageForm ].
        ^ {  f. error }

but honestly, why this method and why not directly do

  self formFromStream: data readStream

swallowing errors is so/so, IMHO. Also, the return value is really unusual. You just want the Form, right. It is not the responsibility of a system class to do UI for you, I think.

> Hilaire
>
>
> Le 31/05/2018 à 16:23, Sven Van Caekenberghe a écrit :
>> Hi Hilaire,
>>
>> On Pharo 7 build 993 it works on both 32 and 64 bits (macOS):
>>
>>
>>
>>
>> The patch (#normalize calls here and there) seems to have been integrated as well your test case (#testNewFromSampleBytes), with your name in the comments !
>>
>
> --
> Dr. Geo
> http://drgeo.eu
>
> <DrGLoader.st.zip>


Reply | Threaded
Open this post in threaded view
|

Re: Image format not recognized

HilaireFernandes
This is what I did, But I hope this problem will not hit somewhere else.


Le 31/05/2018 à 18:06, Sven Van Caekenberghe a écrit :

> That is because that particular method (with no users in the image) uses a deprecated class, change it to the simpler
>
> createAFormFrom: data
> | error f |
> error := ''.
> f := [ self formFromStream: data readStream ] ifError:
> [ :a :b |
> error := a printString , '  ' , b printString.
> (StringMorph contents: error)
> color: Color red;
> imageForm ].
> ^ {  f. error }
>
> but honestly, why this method and why not directly do
>
>    self formFromStream: data readStream
>
> swallowing errors is so/so, IMHO. Also, the return value is really unusual. You just want the Form, right. It is not the responsibility of a system class to do UI for you, I think.

--
Dr. Geo
http://drgeo.eu



Reply | Threaded
Open this post in threaded view
|

Re: Image format not recognized

Sven Van Caekenberghe-2
Great, so you agree that #createAFormFrom: is a candidate for removal ?

> On 31 May 2018, at 19:01, Hilaire <[hidden email]> wrote:
>
> This is what I did, But I hope this problem will not hit somewhere else.
>
>
> Le 31/05/2018 à 18:06, Sven Van Caekenberghe a écrit :
>> That is because that particular method (with no users in the image) uses a deprecated class, change it to the simpler
>>
>> createAFormFrom: data
>> | error f |
>> error := ''.
>> f := [ self formFromStream: data readStream ] ifError:
>> [ :a :b |
>> error := a printString , '  ' , b printString.
>> (StringMorph contents: error)
>> color: Color red;
>> imageForm ].
>> ^ {  f. error }
>>
>> but honestly, why this method and why not directly do
>>
>>   self formFromStream: data readStream
>>
>> swallowing errors is so/so, IMHO. Also, the return value is really unusual. You just want the Form, right. It is not the responsibility of a system class to do UI for you, I think.
>
> --
> Dr. Geo
> http://drgeo.eu
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Image format not recognized

Sven Van Caekenberghe-2
In reply to this post by HilaireFernandes


> On 31 May 2018, at 13:23, Hilaire <[hidden email]> wrote:
>
> Oh, but wait PNG reader seems to break now on another part... See screenshot.

Did you see https://github.com/DraagrenKirneh/PngSuiteExplorer ? We score 100% on the http://www.schaik.com/pngsuite2011 test suite.
Reply | Threaded
Open this post in threaded view
|

Re: Image format not recognized

HilaireFernandes
In reply to this post by Sven Van Caekenberghe-2
Yes, I use only #formFromStream: message now

Hilaire


Le 31/05/2018 à 19:43, Sven Van Caekenberghe a écrit :
> Great, so you agree that #createAFormFrom: is a candidate for removal ?

--
Dr. Geo
http://drgeo.eu



Reply | Threaded
Open this post in threaded view
|

Re: Image format not recognized

HilaireFernandes
In reply to this post by Sven Van Caekenberghe-2
Le 31/05/2018 à 21:27, Sven Van Caekenberghe a écrit :
>> On 31 May 2018, at 13:23, Hilaire<[hidden email]>  wrote:
>>
>> Oh, but wait PNG reader seems to break now on another part... See screenshot.
> Did you seehttps://github.com/DraagrenKirneh/PngSuiteExplorer  ? We score 100% on thehttp://www.schaik.com/pngsuite2011  test suite.
>

Cool. Nice to know.

Hilaire

--
Dr. Geo
http://drgeo.eu



Reply | Threaded
Open this post in threaded view
|

Re: Image format not recognized

Ben Coman
In reply to this post by Sven Van Caekenberghe-2


On 1 June 2018 at 03:27, Sven Van Caekenberghe <[hidden email]> wrote:

Did you see https://github.com/DraagrenKirneh/PngSuiteExplorer ? We score 100% on the http://www.schaik.com/pngsuite2011 test suite.

So would it be worthwhile integrating those directly into Pharo?

cheers -ben
Reply | Threaded
Open this post in threaded view
|

Re: Image format not recognized

Sven Van Caekenberghe-2


> On 1 Jun 2018, at 04:58, Ben Coman <[hidden email]> wrote:
>
>
>
> On 1 June 2018 at 03:27, Sven Van Caekenberghe <[hidden email]> wrote:
>
> Did you see https://github.com/DraagrenKirneh/PngSuiteExplorer ? We score 100% on the http://www.schaik.com/pngsuite2011 test suite.
>
> So would it be worthwhile integrating those directly into Pharo?

It requires the download of an external resource, always a bit tricky ...

And although PngSuiteExplorer is really nice, just downloading the .zip and gt inspecting a file reference to it gives you a big part of the same functionality for free (as the .png are shown).
Reply | Threaded
Open this post in threaded view
|

Re: Image format not recognized

Sven Van Caekenberghe-2
In reply to this post by Sven Van Caekenberghe-2
https://pharo.manuscript.com/f/cases/22035/Delete-PNGReadWriter-class-createAFormFrom

> On 31 May 2018, at 19:43, Sven Van Caekenberghe <[hidden email]> wrote:
>
> Great, so you agree that #createAFormFrom: is a candidate for removal ?
>
>> On 31 May 2018, at 19:01, Hilaire <[hidden email]> wrote:
>>
>> This is what I did, But I hope this problem will not hit somewhere else.
>>
>>
>> Le 31/05/2018 à 18:06, Sven Van Caekenberghe a écrit :
>>> That is because that particular method (with no users in the image) uses a deprecated class, change it to the simpler
>>>
>>> createAFormFrom: data
>>> | error f |
>>> error := ''.
>>> f := [ self formFromStream: data readStream ] ifError:
>>> [ :a :b |
>>> error := a printString , '  ' , b printString.
>>> (StringMorph contents: error)
>>> color: Color red;
>>> imageForm ].
>>> ^ {  f. error }
>>>
>>> but honestly, why this method and why not directly do
>>>
>>>  self formFromStream: data readStream
>>>
>>> swallowing errors is so/so, IMHO. Also, the return value is really unusual. You just want the Form, right. It is not the responsibility of a system class to do UI for you, I think.
>>
>> --
>> Dr. Geo
>> http://drgeo.eu
>>
>>
>>
>