GithubHelp home page GithubHelp logo

Comments (11)

erasmospunk avatar erasmospunk commented on May 18, 2024

Also I don't know if it is related with this issue but the official CLI builds from http://pngquant.org/ are giving me segmentation fault and "illegal instruction: 4" in another machine. Both are using OS X 10.7, it works just fine in 10.8.

from pngquant.

kornelski avatar kornelski commented on May 18, 2024

It looks like your compiler doesn't have Cocoa headers in search path. I'm not sure how to make that work, because clang on my system (with xcode commandline tools) doesn't require any extra arguments to see CoreGraphics headers.

Can you compile this?

clang -c rwpng_cocoa.m -o rwpng_cocoa.o -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -I/usr/local/include -I/opt/X11/include

#import is the preferred method of inclusion in Objective-C, and methods that rwpng_cocoa.m uses are part of CoreGraphics, so I think this line is correct.

The change in saturation is due to color profile support in Cocoa. With stock libpng pngquant can't support color profiles, and dropping of color profiles often increases saturation. With Cocoa it loads images as sRGB and saves them tagged as sRGB, so the less saturated version is actually more accurate representation of the image.

I've rebuilt the executables with -mmacosx-version-min=10.6 passed to the linker. Did that fix the problem on 10.7?

from pngquant.

erasmospunk avatar erasmospunk commented on May 18, 2024

The -mmacosx-version-min=10.6 did the job, the bin from pngquant.org now works! Before you were using -mmacosx-version-min=10.7?

I managed to compile rwpng_cocoa.m but I had to change -I/opt/X11/include to -I/usr/X11/include. What happens with Mountain Lion (or Mavericks) that don't have X11 installed by default, the compilation will fail?

It also worked by installing with Homebrew libpng and using -I/usr/local/opt/libpng/include.

Regarding the CoreGraphics.h issue I based on this solution http://stackoverflow.com/a/4173621/1183663, my experience with Objective-C is minimal. Changing #include to #import also worked:

-#import <CoreGraphics/CoreGraphics.h>
+#import <ApplicationServices/ApplicationServices.h>

I don't know why it cannot find CoreGraphics.h by default, I have the latest Xcode and the command line tools installed.

from pngquant.

kornelski avatar kornelski commented on May 18, 2024

I've previously only specified OS version in compiler flags, rather than linker flags.

It's odd, but it seems that OS X doesn't have public libpng. I'm haven't checked whether X11 lib directory exists on stock OS X. If it doesn't, then compilation will fail.

from pngquant.

erasmospunk avatar erasmospunk commented on May 18, 2024

Just tested with Mountain Lion with only X Code and indeed it fails to compile. There is a directory /usr/X11/lib folder with a bunch of dylibs (libpng is also there) but no include folder.

The solution seems to be to install xquartz or libpng with Homebrew.

from pngquant.

kornelski avatar kornelski commented on May 18, 2024

Do you have png.h anywhere else? (locate /png.h or find / -name png.h)

from pngquant.

erasmospunk avatar erasmospunk commented on May 18, 2024

hmmm, this what I found on the Mountain Lion system:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/X11/include/libpng15/png.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/X11/include/png.h

from pngquant.

sindresorhus avatar sindresorhus commented on May 18, 2024

Nothing on 10.8 (without X11), except for the one i installed with Homebrew...

from pngquant.

kornelski avatar kornelski commented on May 18, 2024

Yeah, so that's a pretty sad state. Cocoa has lousy support for saving PNG, so I can't do much without libpng anyway.

from pngquant.

sindresorhus avatar sindresorhus commented on May 18, 2024

@pornel can you include libpng in the build so people don't have to fetch external dependencies?

from pngquant.

kornelski avatar kornelski commented on May 18, 2024

The Mac binaries on pngquant.org are statically linked and don't require external libpng.

Inclusion of png.h in pngquant repository would be controversial.

from pngquant.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.