Hey I am a new user and just tried the -negate function on this file (https://imgur.com/a/LNuo2F7).
If i use this line: "magick convert base.png -negate negate_base.png" is doesnt work. It just gives me a black image.
with this: "magick convert base.png -negate negate_base.jpg" it works.
It also works when i rename the png file to "*.jpg"???? (no clue why) and alter the code to fit the new file-ending.
Maybe somebody can help here?
regards
Problem with -negate on specific png file
Re: Problem with -negate on specific png file
Ok did some testing with the -channel attribute.
When i specify -channel RGB it works with this: "magick convert base.png -channel RGB -negate negate_base.png"
Isn't RGB the default one?
regards
When i specify -channel RGB it works with this: "magick convert base.png -channel RGB -negate negate_base.png"
Isn't RGB the default one?
regards
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Problem with -negate on specific png file
Your image has transparency. JPG does not support transparency. Using -channel rgb tells IM to only negate channels r, g, b (each separately) and not alpha.
So you should flatten the image first and then negate if you want to convert to JPG. Also note that with IM 7, you should use only magick and not magick convert.
So you should flatten the image first and then negate if you want to convert to JPG. Also note that with IM 7, you should use only magick and not magick convert.
Code: Select all
magick img.png -flatten -negate img7.jpg
Re: Problem with -negate on specific png file
OK thanks. My initial idea was not to convert it (png -> png) which didn't worked.
I was confused when it worked when i converted (png -> jpg).
One different question for that type of image should i use jpeg or png?
regards
I was confused when it worked when i converted (png -> jpg).
One different question for that type of image should i use jpeg or png?
regards
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Problem with -negate on specific png file
Use of JPG or PNG depends upon what you want to achieve. If you need to keep alpha, then you should use PNG. If you want the smaller file size, then use JPG. But do not use JPG for any intermediate format, only your final image.
Re: Problem with -negate on specific png file
Ok thanks.
That was all.
Do i need to close this post or something?
regards.
That was all.
Do i need to close this post or something?
regards.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Problem with -negate on specific png file
No you do not. But if you want to, you can go the the title of your first post in this topic and add [RESOLVED] or something like that at the beginning.