Skip to content
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

How to get background color of a png image? #2111

Closed
zhifengzhuang opened this issue Feb 19, 2021 · 5 comments
Closed

How to get background color of a png image? #2111

zhifengzhuang opened this issue Feb 19, 2021 · 5 comments

Comments

@zhifengzhuang
Copy link

image
I use identify -verbose to get background color.
Is there any way to get png background color using libvips?

jcupitt added a commit that referenced this issue Feb 19, 2021
@jcupitt
Copy link
Member

jcupitt commented Feb 19, 2021

I added a thing to git master libvips to read out background. You now see:

$ vipsheader -a audi-8.png 
audi-8.png: 2500x2500 ushort, 3 bands, rgb16, pngload
width: 2500
height: 2500
bands: 3
format: ushort
coding: none
interpretation: rgb16
xoffset: 0
yoffset: 0
xres: 200
yres: 200
filename: audi-8.png
vips-loader: pngload
background: 255 255 255 

Thanks for the suggestion.

@jcupitt jcupitt closed this as completed Feb 19, 2021
@zhifengzhuang
Copy link
Author

hello again @jcupitt.Is gif supported?I can get background color using magickwand.
image

@jcupitt
Copy link
Member

jcupitt commented Feb 20, 2021

I added bg for gifload as well.

$ vipsheader -a 3198.gif 
temp-0: 298x193 uchar, 3 bands, srgb, gifload
width: 298
height: 193
bands: 3
format: uchar
coding: none
interpretation: srgb
xoffset: 0
yoffset: 0
xres: 1
yres: 1
filename: temp-0
vips-loader: gifload
n-pages: 139
loop: 0
delay: 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30
background: 104 54 42 

@jcupitt
Copy link
Member

jcupitt commented Feb 20, 2021

Off-topic, but please don't post screenshots. Just copy-paste the text and put it in triple backticks, eg.:

    ```C
    int this_is = some( C_code );
    ```

Displays as:

int this_is = some( C_code );

See: https://guides.github.com/features/mastering-markdown/

@zhifengzhuang
Copy link
Author

zhifengzhuang commented Feb 20, 2021

I will pay attention to it later.Thanks for your reply!

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

No branches or pull requests

2 participants