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

PSD to PNG output is inverted and... very strange #37

Closed
whalesalad opened this issue Oct 16, 2013 · 6 comments
Closed

PSD to PNG output is inverted and... very strange #37

whalesalad opened this issue Oct 16, 2013 · 6 comments

Comments

@whalesalad
Copy link

Hello,

I was sharing some frustration on twitter the other night while trying to do some image processing stuff for a project. @meltingice replied to my tweet and suggested that I open an issue here. I'd love to help you guys improve the project as this is a really amazing project and if it worked in my particular case I would have saved a ton of time and also been able to build a bit more advanced solution.

My Workflow

I was trying to open a PSD and then export a high-resolution PNG. Equivalent to opening the PSD in the Photoshop application, Save As PNG, and close the file. Nothing too crazy.

I tested this bug with a handful of files from this page and all of them seem to produce the same result. The specific image I will reference for this issue is ARBESKO_695.psdLink to file

PSD as viewed in Photoshop CC

photoshop_screenshot

Output from PSD.rb

psd_rb_export

Here is my IRB Session

irb(main):001:0> require 'psd'
=> true
irb(main):002:0> PSD::VERSION
=> "1.3.0"
irb(main):003:0> shoe = PSD.new('/Users/michael/Downloads/ARBESKO_695.psd')
=> #<PSD:0x007fcad3d53590 @file=#<PSD::File:/Users/michael/Downloads/ARBESKO_695.psd>, @opts={:parse_image=>false, :parse_layer_images=>false}, @header=nil, @resources=nil, @layer_mask=nil, @parsed=false>
irb(main):004:0> shoe.image.save_as_png '/Users/michael/Desktop/arbesko_695.png'
=> #<File:/Users/michael/Desktop/arbesko_695.png (closed)>

I'm not really sure how this is happening. I've tried to pull that inverted png into Photoshop to "reverse engineer" it back into the original but can't seem to get that to happen. It looks like there are some missing channels or something?

My Environment

I'm running OS X 10.9 (hopefully this isn't the main reason). I'm also using ruby 2.0.0p195 installed via rbenv. Let me know if anything else from my env would be helpful.

@meltingice
Copy link
Member

I think this is a bug with the CMYK processing in PSD.rb. I'm checking it out.

@meltingice
Copy link
Member

Yep, the CMYK channels were being read in the wrong order. The alpha channel comes last, not first. Pushing a fix.

@whalesalad
Copy link
Author

Shocking turnaround time. Nice work! Thanks for pushing the fix, i'm building a second phase of this project out and will take this for a spin.

@meltingice
Copy link
Member

Trying to push the new version to Rubygems but it's down at the moment. Also updating psd_native to reflect this fix.

@meltingice
Copy link
Member

Okay, psd-1.3.2 and psd_native-0.3.1 should both be on Rubygems now. Update your bundle and it should fix your problems.

@whalesalad
Copy link
Author

Perfect. Below is the new output. Looks great.

arbesko_695

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