Help with displaying images in a window

76 views
Skip to first unread message

Totally Objects

unread,
Mar 6, 2020, 12:59:18 PM3/6/20
to VA Smalltalk
Ever since VAST V 3.0 (circa 1996 ish) we have had a framework on our website for download that shows how to display an image in a window and have it resize as the window resizes.

Recently, I have dragged this out to use for one of my Seaside websites - Local modellers make scale plastic models and I provide the website to show these. To help me add details of the models, I have a little utility that loops through the list of images in a file, lets me add a description and saves an object in my database that provides the hooks for the web site. 

I am finding that most of my JPEG images won't display using the standard JPG loader. The loader opens the file but the offers a nil return. I know nothing about the structure of a JPEG so cannot debug this. Can anyone help me with this problem.

One of the problem files is attached. Can anyone help me get this to display in VA?

032020006.jpg


Seth Berman

unread,
Mar 6, 2020, 1:22:16 PM3/6/20
to VA Smalltalk
Greetings David,

I just tried the following with 9.2 and 8.5.1 and it seemed to load up the file and answer a valid CgDeviceIndependentImage (4727x4548  depth-24)
CgJPEGFileFormat new loadFromFile: '032020006.jpg'.

It's possible there was a conversion done when you pasted it in google groups?  Maybe download the file you attached here and try it again with my snippet above

- Seth

Totally Objects

unread,
Mar 6, 2020, 2:27:02 PM3/6/20
to VA Smalltalk
It would appear that you are right - I can load the file when I download it but not directly from the original photo. I would put up a zip file so that no conversion can take place but the forum server rejects it. I have used resize utilities to both resize the file and to convert to a PNG and both of these fail as well. Can you suggest another way that I can get the file too you?

David

Esteban Maringolo

unread,
Mar 6, 2020, 2:33:50 PM3/6/20
to va-sma...@googlegroups.com
You can use https://send-anywhere.com/ or https://wetransfer.com and share the link.

Regards!

Esteban A. Maringolo

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to va-smalltalk...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/590b0af2-8190-4526-8588-8e54589a970a%40googlegroups.com.

Wayne Johnston

unread,
Mar 6, 2020, 3:53:24 PM3/6/20
to VA Smalltalk
Could it be a 32-bit image?  I suspect that isn't supported.  See CgJPEGFileFormat>>#convertImageToYCbCr:.  We had experienced similar with CgWinBMPFileFormat>>#loadInfoHeader:.

Totally Objects

unread,
Mar 7, 2020, 6:07:15 AM3/7/20
to VA Smalltalk


On Friday, March 6, 2020 at 8:53:24 PM UTC, Wayne Johnston wrote:
Could it be a 32-bit image?  I suspect that isn't supported.  See CgJPEGFileFormat>>#convertImageToYCbCr:.  We had experienced similar with CgWinBMPFileFormat>>#loadInfoHeader:.

Can you explain a bit more. When I use  CgJPEGFileFormat new loadFromFile: the method returns nil so I have nothing to send to your suggested image.

David

Totally Objects

unread,
Mar 7, 2020, 6:17:43 AM3/7/20
to VA Smalltalk
I tried to upload a zip file but Google wouldn't let me so I have used a transfer web site. Can you download the following 


That is a zip file so it should be the same as the file that I am handling.

Thanks for your help Seth.

David

On Friday, March 6, 2020 at 6:22:16 PM UTC, Seth Berman wrote:

Seth Berman

unread,
Mar 7, 2020, 8:49:52 AM3/7/20
to VA Smalltalk
Hi David,

Glad to help.  The issue is that progressive JPG is not supported in the product.
For those that don't know, this is the ability for the image to "progressively" become clearer as it loads.
We've probably all seen this when looking at map data online and zooming in and out.  You don't see blank or black squares while the image loads, instead
it gets clearer and clearer while it loads.

Interestingly enough, we do support interlaced PNG as of 9.2 which is doing the same type of thing.  And you will see in CgPNGFileFormat that there is
an #interlacedFrameHandler: block you can supply so you can get notifications as each interlaced frame embedded in the PNG loads.

- Seth

Totally Objects

unread,
Mar 7, 2020, 2:40:58 PM3/7/20
to VA Smalltalk
I have downloaded a program called IrFanView which as an option called JPG Lossless Operations. Using this, I now have a set of JPEGs that will load quite happily in 9.2.

Just as a small question - how come PNGs can do it but not JPEGS (which are more prevalent, I should think). 

However, as an aside, I am sure that I tried PNGs but that's for another day.

David
Totally Objects


On Friday, March 6, 2020 at 6:22:16 PM UTC, Seth Berman wrote:

Seth Berman

unread,
Mar 7, 2020, 3:43:26 PM3/7/20
to VA Smalltalk
Hi David,

Both PNG and JPEG are used quite extensively for their various advantages/disadvantages such as lossy vs lossless compression or overall size.
I think each one is more prevalent in certain domains.

In any case, many enhancements we do sort of organically appear with opportunity.  In this case, we were already speeding up PNG by 20x as a precursor for changing our stock icons for the product.  We took a quick look and decided interlaced frame support was easy enough to implement and could make it into our busy schedules.

If we hear of enough customer demand for progressive jpeg (I see nothing in our historical database...so if they do care, they are not telling us about it) or we see similar opportunities like the one above...I can easily imagine it would be implemented.

- Seth

Adriaan van Os

unread,
Mar 8, 2020, 8:39:41 AM3/8/20
to VA Smalltalk
FWIW, we call a shell script from VA that uses ImageMagick (and GhostScript) to manipulate jpg, gif and pdf files. Basically just for creating thumbnails and previews. We have a requirement to do that from the image without the need for writing the files to disk first. For Pharo there is http://smalltalkhub.com/#!/~StefanReichhart/Smagick/, but never got to try it.

Cheers,
Adriaan.

John M McIntosh

unread,
Mar 8, 2020, 3:37:52 PM3/8/20
to va-sma...@googlegroups.com
When we worked on Sophie 15 years we realized that all windows machine had iTunes installed as a music player. But as a side effect that had Apple’s QuickTime DLL which had full support for reading graphic files and making bitmaps. Can you say album covers... just needed some dll calls. Can’t say what the state of that would be today..

....
John M. McIntosh. Corporate Smalltalk Consulting Ltd https://www.linkedin.com/in/smalltalk


Sent from ProtonMail Mobile
--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to va-smalltalk...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/399fa918-019c-4c93-947d-c1580699ca5b%40googlegroups.com.


Totally Objects

unread,
Mar 8, 2020, 5:55:15 PM3/8/20
to VA Smalltalk
I didn't get any better response with PNG so maybe I did something wrong. It would be a bit of a task to move to using them rather than JPEG but it is a thin line between how I got this to work - and thus doing it every month - or move 1,000s of images to PNG. I guess I will carry on - grin.

Thanks for the help Seth. As usual you were very quick to help.
David

Seth Berman

unread,
Mar 8, 2020, 5:59:03 PM3/8/20
to va-sma...@googlegroups.com
Hi David,

My pleasure to help

- Seth

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to va-smalltalk...@googlegroups.com.
--
-----------------------------------------------------
Seth Berman
President & CEO, Instantiations Inc.
Email: sbe...@instantiations.com
Twitter: @sethloco78

Message has been deleted

Edmilson Bringel

unread,
Mar 11, 2020, 1:50:44 AM3/11/20
to VA Smalltalk
A few years ago I needed to change my applications due to the modification in the JFIF header to orient the portrait / landscape photos coming from cell phones and other things, so I started using freeimage.dll ...Today, I downloaded your photo and tested it successfully! Take a look at MSKFreeImageWrapper, too ... but, I needed to make some extensions to work completely ... if you need to, I can help, including exporting classes and extensions.

Regards.
Reply all
Reply to author
Forward
0 new messages