Skip to content

add magickload_source #4592

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jun 28, 2025
Merged

add magickload_source #4592

merged 8 commits into from
Jun 28, 2025

Conversation

jcupitt
Copy link
Member

@jcupitt jcupitt commented Jun 28, 2025

test with eg.:

$ cat MARBLES.BMP | vips magickload_source "[descriptor=0]" x.v
$ cat MARBLES.BMP | vipsthumbnail stdin -o x.jpg

ImageMagick doesn't support generic IO, so it just maps the source into memory and uses the buffer interface.

magick6 and magick7.

See #4530

test with eg.:

```
$ cat MARBLES.BMP | vips magickload_source "[descriptor=0]" x.v
$ cat MARBLES.BMP | vipsthumbnail stdin -o x.jpg
```

ImageMagick doesn't support generic IO, so it just maps the source into memory
and uses the buffer interface.

magick6 and magick7.
@kleisauke
Copy link
Member

It looks like IM7 provides SetCustomStreamReader() and related functions. However, based on my understanding of CustomStreamToImage(), it simply maps the stream into memory or to a temporary file on disk (if the coder lacks the CoderBlobSupportFlag flag).

@jcupitt
Copy link
Member Author

jcupitt commented Jun 28, 2025

Haha so just the same as us then :)

At some point in the future I suppose we can update this thing to use a proper stream interface, if they add one.

@jcupitt
Copy link
Member Author

jcupitt commented Jun 28, 2025

CoderBlobSupportFlag

I guess we could also check this and fall back to the filename interface.

Copy link
Member

@kleisauke kleisauke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! I assume the C declaration (i.e. vips_magickload_source()) was intentionally omitted?

jcupitt and others added 4 commits June 28, 2025 15:24
Co-authored-by: Kleis Auke Wolthuizen <github@kleisauke.nl>
Co-authored-by: Kleis Auke Wolthuizen <github@kleisauke.nl>
ie. if the source has an associated filename
@jcupitt
Copy link
Member Author

jcupitt commented Jun 28, 2025

intentionally omitted?

Ahem, I added the decl, good catch.

I made it use the filename interface if the source has an associated filename, it'll broaden compatibility a little.

@kleisauke
Copy link
Member

Ahem, I added the decl, good catch.

Ah, I think we also need to add the C implementation of this to magickload.c, since magick{6,7}load.c only contains the GObject-specific parts.

I made it use the filename interface if the source has an associated filename, it'll broaden compatibility a little.

Great!

Copy link
Member

@kleisauke kleisauke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jcupitt
Copy link
Member Author

jcupitt commented Jun 28, 2025

I'm rushing and missing stuff :( I've now actually tested against im6 and it seems fine, phew.

Copy link
Member

@kleisauke kleisauke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! This also allows me to remove the buffer-based fallback in the weserv/images project, which was only necessary for BMP and ICO images.

I've updated #2051 too.

@jcupitt jcupitt merged commit 122813f into master Jun 28, 2025
14 checks passed
@jcupitt
Copy link
Member Author

jcupitt commented Jun 28, 2025

Great! Thank you for the help!

@jcupitt jcupitt deleted the add-magicload_source branch June 28, 2025 19:22
@jcupitt jcupitt mentioned this pull request Jul 19, 2025
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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy