Re: html images

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

Re: html images

Dan Shafer-3
I'm no expert, but I can share the experiences of a colleague who has  
been evaluating Squeak primarily from the  perspective of its  
usefulness for building a graphically intense application.

He experimented with PNGReadWriter and with ImageReadwriter and  
reported both of them distorted images pretty badly. (His  
characterization). He concluded after some effort that Squeak cannot  
be used for the kind of app he had in mind. I've seen/heard rumblings  
from time to time on the main Squeak list that the graphics engine in  
Squeak doesn't lend itself well to antialiased rendering of text and  
images but I've had zero experience of my own with it.

Dan

On Jul 8, 2006, at 1:22 PM, Frank Sukhu wrote:

> Greetings,
>
> I have some code that generates html with an embedded image <IMG>.  
> I have
> tried two ways of doing this:
>
> Option 1.   html imageWithForm: (ImageReadWriter formFromFileNamed:  
> fn).
>
> Option 2.   html image: fn.
>
> where 'fn' is the pathname of the jpg file in my filesystem, e.g.,
> "/foo/bar.jpg".
>
>
> When I use Option 1, the resulting image is very grainy - almost  
> unusable.
> Option 2 produces good results.  I am trying to figure out why this  
> is the
> case.
>
> Why is it that ImageReadWriter produces such a poor image when  
> compared to
> the exact file being served by the httpserver?
>
> I would appreciate any clues or pointers.
>
> Thanks,
> Frank
>
>
>
> _______________________________________________
> Seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: html images

Dan Shafer-3
Turns out this may have been a false alarm. My colleague was using an  
old Squeakland.org image. When he moved to the newest Squeak.org  
image, the PNG stuff, at least, cleared up right away. He's now very  
happy.

Not sure about ImageReadWriter in all of that but PNGReadWriter seems  
fine, according to him.

I'm still muddling about in the middle of the Seaside doing basic  
stuff, so I'm not in a position to test any of that.

Dan

On Jul 8, 2006, at 3:45 PM, Dan Shafer wrote:

> I'm no expert, but I can share the experiences of a colleague who  
> has been evaluating Squeak primarily from the  perspective of its  
> usefulness for building a graphically intense application.
>
> He experimented with PNGReadWriter and with ImageReadwriter and  
> reported both of them distorted images pretty badly. (His  
> characterization). He concluded after some effort that Squeak  
> cannot be used for the kind of app he had in mind. I've seen/heard  
> rumblings from time to time on the main Squeak list that the  
> graphics engine in Squeak doesn't lend itself well to antialiased  
> rendering of text and images but I've had zero experience of my own  
> with it.
>
> Dan
>
> On Jul 8, 2006, at 1:22 PM, Frank Sukhu wrote:
>
>> Greetings,
>>
>> I have some code that generates html with an embedded image  
>> <IMG>.  I have
>> tried two ways of doing this:
>>
>> Option 1.   html imageWithForm: (ImageReadWriter  
>> formFromFileNamed: fn).
>>
>> Option 2.   html image: fn.
>>
>> where 'fn' is the pathname of the jpg file in my filesystem, e.g.,
>> "/foo/bar.jpg".
>>
>>
>> When I use Option 1, the resulting image is very grainy - almost  
>> unusable.
>> Option 2 produces good results.  I am trying to figure out why  
>> this is the
>> case.
>>
>> Why is it that ImageReadWriter produces such a poor image when  
>> compared to
>> the exact file being served by the httpserver?
>>
>> I would appreciate any clues or pointers.
>>
>> Thanks,
>> Frank
>>
>>
>>
>> _______________________________________________
>> Seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
> _______________________________________________
> Seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: html images

German Arduino-2
In reply to this post by Dan Shafer-3
Frank Sukhu wrote:

> Greetings,
>
> I have some code that generates html with an embedded image <IMG>.  I have
> tried two ways of doing this:
>
> Option 1.   html imageWithForm: (ImageReadWriter formFromFileNamed: fn).
>
> Option 2.   html image: fn.
>
> where 'fn' is the pathname of the jpg file in my filesystem, e.g.,
> "/foo/bar.jpg".
>
>
> When I use Option 1, the resulting image is very grainy - almost unusable.
> Option 2 produces good results.  I am trying to figure out why this is the
> case.
>
> Why is it that ImageReadWriter produces such a poor image when compared to
> the exact file being served by the httpserver?
>
> I would appreciate any clues or pointers.
>
> Thanks,
> Frank

AFAIK ImageReadWriter use Form which returns ever a gif from its method
asMIMEDocument.

I you change such method by:

asMIMEDocument
| aStream rw |

        aStream := RWBinaryOrTextStream on: String new.
        rw := PNGReadWriter on: aStream.
        rw nextPutImage: self.
        rw close.
        aStream reset.
        ^MIMEDocument contentType: 'image/png' content: aStream contents

you will get the png correctly showed.

HTH.
gsa.

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: html images

Michel Bany-3
German Arduino a écrit :

>
> AFAIK ImageReadWriter use Form which returns ever a gif from its
> method asMIMEDocument.
>
> I you change such method by:
>
> asMIMEDocument
> | aStream rw |
>
>     aStream := RWBinaryOrTextStream on: String new.
>     rw := PNGReadWriter on: aStream.
>     rw nextPutImage: self.
>     rw close.
>     aStream reset.
>     ^MIMEDocument contentType: 'image/png' content: aStream contents
>
> you will get the png correctly showed.
>
I believe there will be no need to change asMIMEDocument if you use this :

    html imageWithFileNamed:  fn

Using the above ensures that the image does not get unnecessarily
converted to gif.
HTH
Michel.
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: html images

cdavidshaffer
In reply to this post by Dan Shafer-3
Frank Sukhu wrote:

>Greetings,
>
>I have some code that generates html with an embedded image <IMG>.  I have
>tried two ways of doing this:
>
>Option 1.   html imageWithForm: (ImageReadWriter formFromFileNamed: fn).
>
>Option 2.   html image: fn.
>
>where 'fn' is the pathname of the jpg file in my filesystem, e.g.,
>"/foo/bar.jpg".
>
>
>When I use Option 1, the resulting image is very grainy - almost unusable.
>Option 2 produces good results.  I am trying to figure out why this is the
>case.
>
>Why is it that ImageReadWriter produces such a poor image when compared to
>the exact file being served by the httpserver?
>
>I would appreciate any clues or pointers.
>
>Thanks,
>Frank
>
Frank,

As a general practice I avoid Option 1.  It is wasteful to go through
the process of having Squeak read your image from a file, convert it to
a Form, then convert it back to some external representation.  The only
reason you might want to do this is if you need to know the dimensions
of the image or to process it in some way or if you already have the
image in a Form in your squeak Image...capital I to distinguish from the
other kind of image ;-)  Option 2 simply creates an IMG tag which refers
directly to the file's path (maybe served by Kom or apache).  You can
use any URL there:

html image: 'http://someserver.com/somePath/to/an/image.png'

If it works for you I suggest putting all of your images in a directory
served by a web server, then using the Seaside config tool set the
'Resource base URL' property to a URL which leads to this folder
(through this server) and then in your code do this:

html image resourceUrl: 'image.png'

Seaside will automatically add the resource base URL to build an
absolute URL for the image.  Hope that helps.

David


html image:
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: html images

Ramon Leon-4
In reply to this post by Dan Shafer-3
> I have some code that generates html with an embedded image <IMG>.  I have
> tried two ways of doing this:
>
> Option 1.   html imageWithForm: (ImageReadWriter formFromFileNamed: fn).
>
> Option 2.   html image: fn.
>
> where 'fn' is the pathname of the jpg file in my filesystem, e.g.,
> "/foo/bar.jpg".
>
>
> When I use Option 1, the resulting image is very grainy - almost unusable.
> Option 2 produces good results.  I am trying to figure out why this is the
> case.
>
> Why is it that ImageReadWriter produces such a poor image when compared to
> the exact file being served by the httpserver?
>
> I would appreciate any clues or pointers.
>
> Thanks,
> Frank

Just to point out an issue, if the image comes out grainy, it's likely
the display depth is set at 16 bit instead of 32 bit, kick up squeaks
display depth and this won't happen.  I ran into the same issue when
using PieChart's and PlotMorph's.  Look in the world menu under
appearance/display depth.

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: html images

German Arduino-2
In reply to this post by Michel Bany-3
Michel Bany wrote:

> German Arduino a écrit :
>
>>
>> AFAIK ImageReadWriter use Form which returns ever a gif from its
>> method asMIMEDocument.
>>
>> I you change such method by:
>>
>> asMIMEDocument
>> | aStream rw |
>>
>>     aStream := RWBinaryOrTextStream on: String new.
>>     rw := PNGReadWriter on: aStream.
>>     rw nextPutImage: self.
>>     rw close.
>>     aStream reset.
>>     ^MIMEDocument contentType: 'image/png' content: aStream contents
>>
>> you will get the png correctly showed.
>>
> I believe there will be no need to change asMIMEDocument if you use this :
>
>    html imageWithFileNamed:  fn
>
> Using the above ensures that the image does not get unnecessarily
> converted to gif.
> HTH
> Michel.

Thanks by the comment Michel, was useful for me.

I've not used #imageWithFileNamed: because I'm yet using Seaside 2.5.

As I understand is a new method in 2.6. Will try ASAP.

Thanks!
gsa.

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside