Skip to content

Commit

Permalink
- fix building with ImageMagick 7
Browse files Browse the repository at this point in the history
- rel 7
  • Loading branch information
janekr committed Dec 26, 2016
1 parent d62ce07 commit 67bd230
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
46 changes: 46 additions & 0 deletions imagemagick7.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
diff -ur pfstools-2.0.4/src/fileformat/pfsinimgmagick.cpp pfstools-2.0.4-im7/src/fileformat/pfsinimgmagick.cpp
--- pfstools-2.0.4/src/fileformat/pfsinimgmagick.cpp 2015-07-15 11:58:19.000000000 +0200
+++ pfstools-2.0.4-im7/src/fileformat/pfsinimgmagick.cpp 2016-12-26 23:03:33.929300971 +0100
@@ -35,6 +35,7 @@

#define PROG_NAME "pfsinimgmagick"

+using namespace Magick;

class QuietException
{
@@ -112,7 +113,7 @@
Magick::Image imImage( ff.fileName );

VERBOSE_STR << "input image gamma: " << imImage.gamma() << std::endl;
- bool hasAlpha = imImage.matte();
+ bool hasAlpha = imImage.alpha();
if( hasAlpha )
VERBOSE_STR << "alpha channel found" << std::endl;

@@ -127,18 +128,19 @@

// Copy line by line to pfs::Frame
int pixInd = 0;
- const float maxValue = (float)(1<<QuantumDepth) - 1;
+ const float maxValue = (float)QuantumRange;
for( int r = 0; r < imImage.rows(); r++ ) {
- const Magick::PixelPacket *pixels =
+ const Magick::Quantum *pixels =
imImage.getConstPixels( 0, r, imImage.columns(), 1 );

for( int c = 0; c < imImage.columns(); c++ ) {
- (*X)(pixInd) = (float)pixels[c].red / maxValue;
- (*Y)(pixInd) = (float)pixels[c].green / maxValue;
- (*Z)(pixInd) = (float)pixels[c].blue / maxValue;
+ (*X)(pixInd) = (float)MagickCore::GetPixelRed(imImage.image(), pixels) / maxValue;
+ (*Y)(pixInd) = (float)MagickCore::GetPixelGreen(imImage.image(), pixels) / maxValue;
+ (*Z)(pixInd) = (float)MagickCore::GetPixelBlue(imImage.image(), pixels) / maxValue;
if( alpha != NULL )
- (*alpha)(pixInd) = (float)pixels[c].opacity / maxValue;
+ (*alpha)(pixInd) = (float)MagickCore::GetPixelAlpha(imImage.image(), pixels) / maxValue;
pixInd++;
+ pixels += GetPixelChannels(imImage.image());
}
}

4 changes: 3 additions & 1 deletion pfstools.spec
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ Summary: pfstools for High Dynamic Range Images and Video
Summary(pl.UTF-8): Narzędzia do obrazów i wideo o dużym zakresie luminancji
Name: pfstools
Version: 2.0.4
Release: 6
Release: 7
License: LGPL v2.1+
Group: Libraries
Source0: http://downloads.sourceforge.net/pfstools/%{name}-%{version}.tgz
# Source0-md5: f17e2834798cda75d32b2fcd11826d82
Patch0: pfstools-2.0.4-maptype.patch
Patch1: pfstools-2.0.4-octinstall.patch
Patch2: imagemagick7.patch
URL: http://pfstools.sourceforge.net/
BuildRequires: ImageMagick-c++-devel >= 6.0
BuildRequires: OpenEXR-devel >= 1.0
Expand Down Expand Up @@ -95,6 +96,7 @@ Wiązania języka Octave do pfstools.
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1

%build
install -d build
Expand Down

0 comments on commit 67bd230

Please sign in to comment.