start hacking in a CMYK->XYZ import
plus an embedded cmyk profile as a fallback
This commit is contained in:
parent
99c0a674a4
commit
25aed749e3
@ -841,6 +841,14 @@ if test x"$with_lcms" != x"no"; then
|
|||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# we need a conditional for this to only compile in fallback profiles if lcms
|
||||||
|
# is detected
|
||||||
|
if test x"$with_lcms" != x"no"; then
|
||||||
|
AM_CONDITIONAL(ENABLE_LCMS, true)
|
||||||
|
else
|
||||||
|
AM_CONDITIONAL(ENABLE_LCMS, false)
|
||||||
|
fi
|
||||||
|
|
||||||
# OpenEXR
|
# OpenEXR
|
||||||
AC_ARG_WITH([OpenEXR],
|
AC_ARG_WITH([OpenEXR],
|
||||||
AS_HELP_STRING([--without-OpenEXR], [build without OpenEXR (default: test)]))
|
AS_HELP_STRING([--without-OpenEXR], [build without OpenEXR (default: test)]))
|
||||||
|
103
libvips/colour/CMYK2XYZ.c
Normal file
103
libvips/colour/CMYK2XYZ.c
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
/* Use lcms to move from CMYK to XYZ, if we can. This needs a working
|
||||||
|
* vips_icc_import.
|
||||||
|
*
|
||||||
|
* 21/12/18
|
||||||
|
* - from CMYK2XYZ
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
This file is part of VIPS.
|
||||||
|
|
||||||
|
VIPS is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
|
02110-1301 USA
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif /*HAVE_CONFIG_H*/
|
||||||
|
#include <vips/intl.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_LCMS2
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#include <vips/vips.h>
|
||||||
|
|
||||||
|
#include "pcolour.h"
|
||||||
|
|
||||||
|
typedef VipsColourTransform VipsCMYK2XYZ;
|
||||||
|
typedef VipsColourTransformClass VipsCMYK2XYZClass;
|
||||||
|
|
||||||
|
G_DEFINE_TYPE( VipsCMYK2XYZ, vips_CMYK2XYZ, VIPS_TYPE_COLOUR_TRANSFORM );
|
||||||
|
|
||||||
|
void
|
||||||
|
vips_CMYK2XYZ_line( VipsColour *colour, VipsPel *out, VipsPel **in, int width )
|
||||||
|
{
|
||||||
|
/* Or maybe subclass icc_import? */
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
vips_CMYK2XYZ_class_init( VipsCMYK2XYZClass *class )
|
||||||
|
{
|
||||||
|
VipsObjectClass *object_class = (VipsObjectClass *) class;
|
||||||
|
VipsColourClass *colour_class = VIPS_COLOUR_CLASS( class );
|
||||||
|
|
||||||
|
object_class->nickname = "CMYK2XYZ";
|
||||||
|
object_class->description = _( "transform CMYK to XYZ" );
|
||||||
|
|
||||||
|
colour_class->process_line = vips_CMYK2XYZ_line;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
vips_CMYK2XYZ_init( VipsCMYK2XYZ *CMYK2XYZ )
|
||||||
|
{
|
||||||
|
VipsColour *colour = VIPS_COLOUR( CMYK2XYZ );
|
||||||
|
|
||||||
|
colour->interpretation = VIPS_INTERPRETATION_XYZ;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /*HAVE_LCMS2*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* vips_CMYK2XYZ: (method)
|
||||||
|
* @in: input image
|
||||||
|
* @out: (out): output image
|
||||||
|
* @...: %NULL-terminated list of optional named arguments
|
||||||
|
*
|
||||||
|
* Turn XYZ to CMYK.
|
||||||
|
*
|
||||||
|
* Returns: 0 on success, -1 on error
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
vips_CMYK2XYZ( VipsImage *in, VipsImage **out, ... )
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
int result;
|
||||||
|
|
||||||
|
va_start( ap, out );
|
||||||
|
result = vips_call_split( "CMYK2XYZ", ap, in, out );
|
||||||
|
va_end( ap );
|
||||||
|
|
||||||
|
return( result );
|
||||||
|
}
|
@ -1,6 +1,13 @@
|
|||||||
noinst_LTLIBRARIES = libcolour.la
|
noinst_LTLIBRARIES = libcolour.la
|
||||||
|
|
||||||
|
if ENABLE_LCMS
|
||||||
|
PROFILES = profiles.c profiles.h
|
||||||
|
else
|
||||||
|
PROFILES =
|
||||||
|
endif
|
||||||
|
|
||||||
libcolour_la_SOURCES = \
|
libcolour_la_SOURCES = \
|
||||||
|
$(PROFILES) \
|
||||||
colour.c \
|
colour.c \
|
||||||
pcolour.h \
|
pcolour.h \
|
||||||
colourspace.c \
|
colourspace.c \
|
||||||
@ -33,4 +40,11 @@ libcolour_la_SOURCES = \
|
|||||||
XYZ2scRGB.c \
|
XYZ2scRGB.c \
|
||||||
scRGB2sRGB.c
|
scRGB2sRGB.c
|
||||||
|
|
||||||
|
profiles.c:
|
||||||
|
./wrap_profiles.sh profiles profiles
|
||||||
|
|
||||||
|
EXTRA_DIST = \
|
||||||
|
profiles \
|
||||||
|
wrap-profiles.sh
|
||||||
|
|
||||||
AM_CPPFLAGS = -I${top_srcdir}/libvips/include @VIPS_CFLAGS@ @VIPS_INCLUDES@
|
AM_CPPFLAGS = -I${top_srcdir}/libvips/include @VIPS_CFLAGS@ @VIPS_INCLUDES@
|
||||||
|
16875
libvips/colour/profiles.c
Normal file
16875
libvips/colour/profiles.c
Normal file
File diff suppressed because it is too large
Load Diff
3
libvips/colour/profiles.h
Normal file
3
libvips/colour/profiles.h
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
/* header for coded files, generated automatically */
|
||||||
|
|
||||||
|
extern char *vips__coded_cmyk ;
|
BIN
libvips/colour/profiles/cmyk.icm
Normal file
BIN
libvips/colour/profiles/cmyk.icm
Normal file
Binary file not shown.
27
libvips/colour/wrap-profiles.sh
Executable file
27
libvips/colour/wrap-profiles.sh
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# code up the binary files in $1 as a set of base64-encoded strings in $2
|
||||||
|
|
||||||
|
in=$1
|
||||||
|
out_c=$2.c
|
||||||
|
out_h=$2.h
|
||||||
|
|
||||||
|
echo "/* coded files, generated automatically */" > $out_c
|
||||||
|
echo "" >> $out_c
|
||||||
|
for file in $in/*; do
|
||||||
|
root=${file%.icm}
|
||||||
|
base=${root##*/}
|
||||||
|
echo char \*vips__coded_$base = >> $out_c
|
||||||
|
base64 $file | sed 's/\(.*\)/"\1"/g' >> $out_c
|
||||||
|
echo ';' >> $out_c
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "/* header for coded files, generated automatically */" > $out_h
|
||||||
|
echo "" >> $out_h
|
||||||
|
for file in $in/*; do
|
||||||
|
root=${file%.icm}
|
||||||
|
base=${root##*/}
|
||||||
|
echo extern char \*vips__coded_$base ';' >> $out_h
|
||||||
|
done
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user