When trying to convert a multi-page pdf to jpeg i got a pdf file
instead of a jpeg file. I figured that the pdf that worked was
a one-page pdf and the pdf that did not work was a two-page pdf.
My theory was that the two pages was loaded as to images in the
wand and that the format was set on the first page and it exported
the second page. And since the second page had the old format, it
was exported as a pdf.
Resetting the page iterator before exporting the image fixed the
bug, and the multi-page pdf was exported as a jpeg. The image that
was exported was just the first page, but it works for my usage.
build.rs now recognizes next environment variables:
IMAGE_MAGICK_DIR - installation directory
IMAGE_MAGICK_LIB_DIRS - list of lib dirs split by ":"
IMAGE_MAGICK_INCLUDE_DIRS - list of include dirs split by ":"
IMAGE_MAGICK_LIBS - list of the libs to link to
IMAGE_MAGICK_STATIC - if set to value other than 0, link statically
get_image_page (MagickGetImagePage) is especially useful
for determining the overall dimensions of a GIF, which may have
frames with different widths and heights. In such cases,
get_image_width and get_image_height report the dimensions of
the last frame only.
It seems that pkg-config ignores the --max-version option when combined with
certain other options. As such, that check was not really working. Since the
pkg-config Rust crate always passes those certain other options, it is
necessary to invoke the pkg-config command directly from build.rs instead.
cargo test passes
Using the changes from @gadomski along with some additional work, to get the
generated bindings working again. Works on macOS and FreeBSD 11. A couple of
hacks are needed for FreeBSD, but nothing too serious.
Changed to use the libc prefix, and changed to use the generated enums.
Fixes#22, #15, and #14
cargo test passes
Using rust-bindgen to generate the bindings for the MagickWand library is
extremely difficult with the new versions of rust-bindgen. The old versions
of the generated bindings will be used for now, and nothing will be
generated at build time.
cargo test passes
The size of the image can vary from version to version (of ImageMagick) and
platform to platform (i.e. MacOS and FreeBSD). As such, allow for a degree
of variability in the resulting image size.
cargo test passes