[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: images in Perl/Tk



On 2024-03-19 13:29, debian-user@howorth.org.uk wrote:
<snipped>

There's a bug in your program above, when used for PNG or JPEG. It's a
perl error and I expect you would have got an answer on perlmonks as I
suggested.

The error is described on
https://docstore.mik.ua/orelly/perl3/tk/ch17_01.htm

Look for "Notice the Photo image formats JPEG, PNG, and TIFF—not part
of the Perl/Tk distribution—must be specifically imported."


Only the .bmp file displays other files have error.

"Uncaught exception from user code:
	couldn't recognize data in image file "images/red.png" at
/usr/lib/x86_64-linux-gnu/perl5/5.38/Tk/Image.pm line 21.
	Tk::Image::new("Tk::Photo", MainWindow=HASH(0x560632dc9098),
"-file", "images/red.png") called at
/usr/lib/x86_64-linux-gnu/perl5/5.38/Tk/Image.pm line 63
	Tk::Image::__ANON__(MainWindow=HASH(0x560632dc9098), "-file",
"images/red.png") called at ./test-image.pl line 8"

I've installed
Tk, libgraphics-magick-perl, libimage-imlib2-perl, tkagif, tkblt,
tklib, libtk-img, tkpng.

Now that I know .bmp works I can use that.
Wonder tho' why others don't display, Bookworm and Trixie.
If there is some other module to include I can't discover what it's
name is as yet.
Tk::Photo is a module but seems to be included in Perl/Tk
I'm not really understanding if the Perl/Tk is a rewrite or an
interface to Tk modules.

You might want to read the book! :) Or even the CPAN entry for Tk if
you want to understand more.

Chapter 17 starts by saying Perl/Tk supports the bitmap, Pixmap, and Photo image types.
xbm, xpm, bmp, png, xbm, ppm, jpg, xpm, gif, tif =o)

Adding Tk::PNG, Tk::JPEG indeed allows those filetypes to be used.

PS: My emails to list take forever, if at all, to arrive here. I saw Gareth's mail on the debian website but that hasn't arrived here. That may be a feature of gmail so I guess I should subscribe from another email address to check.
mick


Reply to: