Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

tclfpdf

113 views
Skip to first unread message

Manfred Stelzhammer

unread,
Jun 17, 2023, 7:33:10 PM6/17/23
to
Hello

I have a Problem with tclfpdf.

I try to insert a picture.


% tclfpdf::Image [pwd]/logo.gif 30 30


The first error:
"can't read "::env(PROCESSOR_ARCHITECTURE)": no such variable"

I solved it with: "set ::env(PROCESSOR_ARCHITECTURE) 64"


The second error:
"can't read "a": no such variable"

Who can I solved this problem?


regards

manfred



et99

unread,
Jun 17, 2023, 9:10:41 PM6/17/23
to
When I run a 64 bit tcl I see:

env(PROCESSOR_ARCHITECTURE) = AMD64

32 bit:

env(PROCESSOR_ARCHITECTURE) = x86

System wide, it's set to AMD64, not sure how it shows up as X86 when
running a 32 bit tclkit.



et99

unread,
Jun 17, 2023, 9:12:49 PM6/17/23
to
Forgot to mention, this is on my windows 10 system.

Manfred Stelzhammer

unread,
Jun 18, 2023, 10:20:40 AM6/18/23
to
Hi

I use kubuntu.

With .jpeg and .jpg it works.

But .png and .gif it unfortunately doesn't work.


Regards

Manfred




Am 17.06.23 um 23:12 schrieb et99:

et99

unread,
Jun 18, 2023, 12:00:16 PM6/18/23
to
Are you trying to use the file logo.gif in the examples folder?

That file is interlaced. Try converting it to non-interlaced.
Check if your .png files are interlaced as well.

Internally the code converts a .gif to a .png. On my 8.6.9 32 bit tcl/tk
it creates an interlaced .png and gets an error saying interlaced
not supported.

On my 8.6.12 and 8.6.13 64 bit tcl/tk it converts it to a non-interlaced .png and
it works.

I don't know if its 32 vs 64 or the version of Tk that makes the difference.





Manfred Stelzhammer

unread,
Jun 18, 2023, 2:32:06 PM6/18/23
to
Hi

I think, I make a workaround.
I convert the file to a jpeg, and after the tclfpdf::Image command I
delete the temporary file.


proc convert-to-jpeg {file} {
image create photo _tempimage
_tempimage read $file
_tempimage write mytempfile[file tail [file rootname $file]].jpeg
return mytempfile[file tail [file rootname $file]].jpeg
}

set mytempimage [convert-to-jpeg image.gif]

tclfpdf::Image $mytempimage 30 30
file delete $mytempimage



regards

Manfred

Am 18.06.23 um 14:00 schrieb et99:

et99

unread,
Jun 18, 2023, 7:01:18 PM6/18/23
to
Good idea. Note you have the source code, and here's what they do.
Maybe submit an issue on github.

proc ::tclfpdf::_parsegif { file } {
;#Note: sometimes there are some problems converting GIF to PNG
;# using img. One alternative is use the utility gif2png an then load the file as PNG
set img "_$file"
image create photo $img
;#first frame in case of animated GIF
$img read $file -format "gif -index 0"
set tmp $file.png
$img write $tmp
set info [_parsepng $tmp]
file delete $tmp
return $info
}


Ralf Fassel

unread,
Jun 19, 2023, 11:25:45 AM6/19/23
to
* Manfred Stelzhammer <man...@antispam.at>
| proc convert-to-jpeg {file} {
| image create photo _tempimage
| _tempimage read $file
| _tempimage write mytempfile[file tail [file rootname $file]].jpeg

You need to delete the _tempimage here before returning, otherwise you
have a memory leak - albeit a small one.

R'

Manfred Stelzhammer

unread,
Jun 19, 2023, 3:12:44 PM6/19/23
to
Thank's

manfred

Am 19.06.23 um 13:25 schrieb Ralf Fassel:
0 new messages