Comments (11)
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.
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.
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.
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.
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.
Do you have png.h anywhere else? (locate /png.h
or find / -name png.h
)
from pngquant.
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.
Nothing on 10.8 (without X11), except for the one i installed with Homebrew...
from pngquant.
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.
@pornel can you include libpng in the build so people don't have to fetch external dependencies?
from pngquant.
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)
- [Minor typo I think] https versus http links on the homepage at: https://pngquant.org/releases.html HOT 1
- [Feature Request] Updating Windows binary version on pngquant.org HOT 5
- Feat.req. Upload new releases to Github Releases tab
- pngquant vs. oxipng HOT 1
- [feature request] constraint colors from given palette HOT 1
- Cannot Open file for reading in Ubuntu 21.04 (64 Bit) HOT 2
- resouce file in tar break some automated build
- Possibility of adding liq_image_create_argb() HOT 1
- no matching package named `imagequant-sys` found HOT 2
- pngquant doesn't work inside Windows Docker containers HOT 6
- Input and output parameters HOT 2
- on windows pngquant directs output to stderr not stdout HOT 1
- Feature Request: Option to skip image if it already has 256 colors or less. HOT 2
- tar error while installing with brew on macos HOT 3
- OpenMP warning on Clang systems HOT 1
- Windows Build - Executing from current directory should include exclusion for pngquant.exe HOT 1
- Using more than 4 bits per channel with posterization HOT 3
- Is it possible to keep fully transparent (0 alpha) areas of image fully transparent? HOT 2
- Supported on Apple silicon? HOT 1
- Option to preserve color for fully transparent pixels HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pngquant.