Skip to content

Dev Loading PNG data (or other) into a Raku variable instead of into a file.#4

Merged
lizmat merged 9 commits intoraku-community-modules:mainfrom
jforget:dev
Apr 7, 2026
Merged

Dev Loading PNG data (or other) into a Raku variable instead of into a file.#4
lizmat merged 9 commits intoraku-community-modules:mainfrom
jforget:dev

Conversation

@jforget
Copy link
Copy Markdown

@jforget jforget commented Apr 7, 2026

This pull request adds function gdImagePngPtr (and similar gdImageXXXPtr functions).

Also: the POD documentation contains the list of libgd functions ported to GD::Raw.

@lizmat lizmat merged commit 2df4ae0 into raku-community-modules:main Apr 7, 2026
2 checks passed
@lizmat
Copy link
Copy Markdown
Collaborator

lizmat commented Apr 7, 2026

Hmm... the author tests don't pass:

% raku -I. xt/gdimagepngptr.rakutest
1..1
raku(5327,0x1f584e240) malloc: Double free of object 0x142805530
raku(5327,0x1f584e240) malloc: *** set a breakpoint in malloc_error_break to debug
zsh: abort      raku -I. xt/gdimagepngptr.rakutest

@jforget: could you verify / fix?

jforget added a commit to jforget/GD-Raw that referenced this pull request Apr 9, 2026
@jforget
Copy link
Copy Markdown
Author

jforget commented Apr 9, 2026

On my computer, the author tests run without any glitch. Yet, when I read the test script, I see that gdFree was called twice in a row, in lines 64 and 87, on both sides of my $test = ....

Fixed on my repo. Should I create a new pull request?

@lizmat
Copy link
Copy Markdown
Collaborator

lizmat commented Apr 9, 2026

No need for a new PR yet :-)

With that addition gdFree removed, the test runs ok, but fails:

% raku -I. xt/gdimagepngptr.rakutest
1..1
not ok 1 - 
# Failed test at xt/gdimagepngptr.rakutest line 89
# You failed 1 test of 1

@jforget
Copy link
Copy Markdown
Author

jforget commented Apr 9, 2026

I will be away from my keyboard for a few days, possibly until monday. Sorry about that.
In the meantime, can you store the content of variable $test in a permanent file, so I can compare it to ported-gdimagepngptr/gd-image-xxx-ptr.html?

Thank you in advance.

@lizmat
Copy link
Copy Markdown
Collaborator

lizmat commented Apr 9, 2026

@jforget
Copy link
Copy Markdown
Author

jforget commented Apr 13, 2026

There is a tiny difference in the embedded JPEG data. This can be explained in a few ways.

  • Your version of libjpeg is not the same as mine

  • The JPEG generation uses a quality parameter and the default quality on your computer is not the same as on my computer

  • JPEG is a lossy compression scheme, so there is some kind of unpredicatability (not sure about that reason, though).

Maybe I should at least remove testing gdImageJpegPtr from the test script.

Should I remove other formats? Maybe I should remove GIF? There are two functions for PNG: gdImagePngPtrEx with a required explicit $compression parameter and gdImagePngPtr which uses a system-wide value for the implicit compression. Should I discard gdImagePngPtr and keep only gdImagePngPtrEx?

@lizmat
Copy link
Copy Markdown
Collaborator

lizmat commented Apr 13, 2026

Perhaps a better test that wouldn't depend on identity of the whole?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants