How does one specify a format for an ImageMorph based on a binary stream

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

How does one specify a format for an ImageMorph based on a binary stream

Andy Burnett
I am trying to do some simple image manipulation. Basically, I want to subtract one image from another, to see what's left.

As an experiment, did

aStream := ReadStream on: image1 imageExport.
newImageMorph := ImageMorph fromStream:aStream.

Unfortunately, this fails because there is no subclass to handle the binary stream. I couldn't find a way to specify what format the image was in.  Does anyone know how to do this?

Cheers
Andy
Reply | Threaded
Open this post in threaded view
|

Re: How does one specify a format for an ImageMorph based on a binary stream

HilaireFernandes
I am not sure to understand you, but should you not use:

ImageReadWriter class>>formFromStream:

Then use Form or BitBlt protocols for your bits manipulations?

Hilaire

Le 14/08/2016 à 10:02, Andy Burnett a écrit :

> I am trying to do some simple image manipulation. Basically, I want to
> subtract one image from another, to see what's left.
>
> As an experiment, did
>
> aStream := ReadStream on: image1 imageExport.
> newImageMorph := ImageMorph fromStream:aStream.
>
> Unfortunately, this fails because there is no subclass to handle the
> binary stream. I couldn't find a way to specify what format the image
> was in.  Does anyone know how to do this?
>
> Cheers
> Andy

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


Reply | Threaded
Open this post in threaded view
|

Re: How does one specify a format for an ImageMorph based on a binary stream

Sven Van Caekenberghe-2
ImageReadWriter formFromStream: 'http://pharo.org/files/pharo.png' asUrl retrieveContents readStream

(ImageReadWriter formFromStream: 'http://pharo.org/files/pharo.png' asUrl retrieveContents readStream) asMorph openInWindow

> On 14 Aug 2016, at 04:51, Hilaire <[hidden email]> wrote:
>
> I am not sure to understand you, but should you not use:
>
> ImageReadWriter class>>formFromStream:
>
> Then use Form or BitBlt protocols for your bits manipulations?
>
> Hilaire
>
> Le 14/08/2016 à 10:02, Andy Burnett a écrit :
>> I am trying to do some simple image manipulation. Basically, I want to
>> subtract one image from another, to see what's left.
>>
>> As an experiment, did
>>
>> aStream := ReadStream on: image1 imageExport.
>> newImageMorph := ImageMorph fromStream:aStream.
>>
>> Unfortunately, this fails because there is no subclass to handle the
>> binary stream. I couldn't find a way to specify what format the image
>> was in.  Does anyone know how to do this?
>>
>> Cheers
>> Andy
>
> --
> Dr. Geo
> http://drgeo.eu
>
>


Reply | Threaded
Open this post in threaded view
|

Re: How does one specify a format for an ImageMorph based on a binary stream

Andy Burnett
In reply to this post by Andy Burnett
Thanks @Hilaire and @Sven. I had misunderstood the purpose of the imageExport method.

Cheers
Andy