swap colors/channels

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: swap colors/channels

Post by fmw42 »

Tosyk wrote:thank you, but i keep getting those artifacts :?
My result is perfectly fine on IM 6.7.9.6 Q16 Mac OSX Snow Leopard. What version of IM are you using and what platform?
User avatar
Tosyk
Posts: 25
Joined: 2012-09-11T18:55:12-07:00
Authentication code: 67789
Location: Armenia

Re: swap colors/channels

Post by Tosyk »

i'm useing latest 6.7.9-4 version on win 7 x64
don't know what cause this strange dots over the image
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: swap colors/channels

Post by fmw42 »

I edited my post above to show you the result.

Did you change the code from unix syntax to windows syntax?

What was your exact command line converted from mine?
User avatar
Tosyk
Posts: 25
Joined: 2012-09-11T18:55:12-07:00
Authentication code: 67789
Location: Armenia

Re: swap colors/channels

Post by Tosyk »

fmw42 wrote:I edited my post above to show you the result.
it looks great
fmw42 wrote:Did you change the code from unix syntax to windows syntax?
ah, no
fmw42 wrote:What was your exact command line converted from mine?
same as yours:

Code: Select all

convert Tex_0807_4.dds -channel rgba -separate +channel -swap 1,3 +delete -combine -channel B -evaluate set 100% +channel -colorspace sRGB Tex_0807_4_swap.png
maybe we can debugging somehow this process? because it's really strange
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: swap colors/channels

Post by fmw42 »

In windows, you need to escape % as %%. Please review http://www.imagemagick.org/Usage/windows/

convert Tex_0807_4.dds -channel rgba -separate +channel -swap 1,3 +delete -combine -channel B -evaluate set 100%% +channel -colorspace sRGB Tex_0807_4_swap.png
User avatar
Tosyk
Posts: 25
Joined: 2012-09-11T18:55:12-07:00
Authentication code: 67789
Location: Armenia

Re: swap colors/channels

Post by Tosyk »

fmw42 wrote:In windows, you need to escape % as %%. Please review http://www.imagemagick.org/Usage/windows/

convert Tex_0807_4.dds -channel rgba -separate +channel -swap 1,3 +delete -combine -channel B -evaluate set 100%% +channel -colorspace sRGB Tex_0807_4_swap.png
it's true but, doesen't work for me either
but useing command:

Code: Select all

-channel rgba -separate
gives me an alpha with those artifacts, does it make sense?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: swap colors/channels

Post by fmw42 »

Sorry, I am out of ideas. The -channel rgba -separate was needed for my code to work. I do not know why it does not work for you. Perhaps you need to upgrade your libpng?

convert -list format

shows

PNG* PNG rw- Portable Network Graphics (libpng 1.4.11)


What version are you using?

Or try saving to gif or jpg or tif and see if that makes a difference.
User avatar
Tosyk
Posts: 25
Joined: 2012-09-11T18:55:12-07:00
Authentication code: 67789
Location: Armenia

Re: swap colors/channels

Post by Tosyk »

i installed latest IM 6.7.9.7 Q16 and trying with many nothing helps, damn((
and png:
PNG* rw- Portable Network Graphics (libpng 1.5.11)

oh maan, what can we do? :( really losing my faith in convert.exe

p.s.:i remember that i'm useing it for year ago or something for extracting alpha and it works
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: swap colors/channels

Post by fmw42 »

try saving to gif or jpg or tif and see if that makes a difference
User avatar
Tosyk
Posts: 25
Joined: 2012-09-11T18:55:12-07:00
Authentication code: 67789
Location: Armenia

Re: swap colors/channels

Post by Tosyk »

fmw42 wrote:try saving to gif or jpg or tif and see if that makes a difference
works the same :(
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: swap colors/channels

Post by fmw42 »

Perhaps Anthony can shed some light. Perhaps my command line is not fully proper.

Also perhaps some other kind Windows user can try this and see if they get your results or not. It could be a Windows only bug.
User avatar
Tosyk
Posts: 25
Joined: 2012-09-11T18:55:12-07:00
Authentication code: 67789
Location: Armenia

Re: swap colors/channels

Post by Tosyk »

fmw42 wrote:Perhaps Anthony can shed some light. Perhaps my command line is not fully proper.
don't know this person
fmw42 wrote:Also perhaps some other kind Windows user can try this and see if they get your results or not. It could be a Windows only bug.
so, i've check it on my work machine and the result is same, but method above working well with .tga textures, but not with .dds, that's odd

i've just converted those .dds files into .tga and .tga works great, without any artifacts at all, so probably problem in my .dds stuff on my pc, or something like that
any thoughts?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: swap colors/channels

Post by fmw42 »

Anthony is one of the IM developers. He is very knowledgeable about the command line.

I suppose it could be a bug on the Windows side for reading .dds files? I would suggest you post your issues and the fact that it works fine on other formats for the input to the Bugs forum with your example image and the command line that works on other input format.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: swap colors/channels

Post by anthony »

Thye look like cell bit order was reversed. Perhaps the alpha channel is not being decoded in-correctly for .dds files

Alpha is hard to see, and it may have slipped under the radar, by the developer of that codec.


But as it seems to be different for different machines. The next thing to try is turning off any multi-threading (on both computers). That can cause weird randomizations when something goes wrong.

If that fails, then it either delegate library, or some OS/Processor specific fault, though that last is unlikely.


This has been posted on the bugs discussion.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
Tosyk
Posts: 25
Joined: 2012-09-11T18:55:12-07:00
Authentication code: 67789
Location: Armenia

Re: swap colors/channels

Post by Tosyk »

thank you fmw42
posted here
Will post solution here if IM developers will help me
Post Reply