%global _empty_manifest_terminate_build 0
Name:		python-img2pdf
Version:	0.4.4
Release:	1
Summary:	Convert images to PDF via direct JPEG inclusion.
License:	LGPL
URL:		https://gitlab.mister-muffin.de/josch/img2pdf
Source0:	https://mirrors.nju.edu.cn/pypi/web/packages/95/b5/f933f482a811fb9a7b3707f60e28f2925fed84726e5a6283ba07fdd54f49/img2pdf-0.4.4.tar.gz
BuildArch:	noarch


%description
Lossless conversion of raster images to PDF. You should use img2pdf if your
priorities are (in this order):
 1. **always lossless**: the image embedded in the PDF will always have the
    exact same color information for every pixel as the input
 2. **small**: if possible, the difference in filesize between the input image
    and the output PDF will only be the overhead of the PDF container itself
 3. **fast**: if possible, the input image is just pasted into the PDF document
    as-is without any CPU hungry re-encoding of the pixel data
Conventional conversion software (like ImageMagick) would either:
 1. not be lossless because lossy re-encoding to JPEG
 2. not be small because using wasteful flate encoding of raw pixel data
 3. not be fast because input data gets re-encoded
Another advantage of not having to re-encode the input (in most common
situations) is, that img2pdf is able to handle much larger input than other
software, because the raw pixel data never has to be loaded into memory.
The following table shows how img2pdf handles different input depending on the
input file format and image color space.
| Format                                | Colorspace                     | Result        |
| ------------------------------------- | ------------------------------ | ------------- |
| JPEG                                  | any                            | direct        |
| JPEG2000                              | any                            | direct        |
| PNG (non-interlaced, no transparency) | any                            | direct        |
| TIFF (CCITT Group 4)                  | monochrome                     | direct        |
| any                                   | any except CMYK and monochrome | PNG Paeth     |
| any                                   | monochrome                     | CCITT Group 4 |
| any                                   | CMYK                           | flate         |
For JPEG, JPEG2000, non-interlaced PNG and TIFF images with CCITT Group 4
encoded data, img2pdf directly embeds the image data into the PDF without
re-encoding it. It thus treats the PDF format merely as a container format for
the image data. In these cases, img2pdf only increases the filesize by the size
of the PDF container (typically around 500 to 700 bytes). Since data is only
copied and not re-encoded, img2pdf is also typically faster than other
solutions for these input formats.
For all other input types, img2pdf first has to transform the pixel data to
make it compatible with PDF. In most cases, the PNG Paeth filter is applied to
the pixel data. For monochrome input, CCITT Group 4 is used instead. Only for
CMYK input no filter is applied before finally applying flate compression.

%package -n python3-img2pdf
Summary:	Convert images to PDF via direct JPEG inclusion.
Provides:	python-img2pdf
BuildRequires:	python3-devel
BuildRequires:	python3-setuptools
BuildRequires:	python3-pip
%description -n python3-img2pdf
Lossless conversion of raster images to PDF. You should use img2pdf if your
priorities are (in this order):
 1. **always lossless**: the image embedded in the PDF will always have the
    exact same color information for every pixel as the input
 2. **small**: if possible, the difference in filesize between the input image
    and the output PDF will only be the overhead of the PDF container itself
 3. **fast**: if possible, the input image is just pasted into the PDF document
    as-is without any CPU hungry re-encoding of the pixel data
Conventional conversion software (like ImageMagick) would either:
 1. not be lossless because lossy re-encoding to JPEG
 2. not be small because using wasteful flate encoding of raw pixel data
 3. not be fast because input data gets re-encoded
Another advantage of not having to re-encode the input (in most common
situations) is, that img2pdf is able to handle much larger input than other
software, because the raw pixel data never has to be loaded into memory.
The following table shows how img2pdf handles different input depending on the
input file format and image color space.
| Format                                | Colorspace                     | Result        |
| ------------------------------------- | ------------------------------ | ------------- |
| JPEG                                  | any                            | direct        |
| JPEG2000                              | any                            | direct        |
| PNG (non-interlaced, no transparency) | any                            | direct        |
| TIFF (CCITT Group 4)                  | monochrome                     | direct        |
| any                                   | any except CMYK and monochrome | PNG Paeth     |
| any                                   | monochrome                     | CCITT Group 4 |
| any                                   | CMYK                           | flate         |
For JPEG, JPEG2000, non-interlaced PNG and TIFF images with CCITT Group 4
encoded data, img2pdf directly embeds the image data into the PDF without
re-encoding it. It thus treats the PDF format merely as a container format for
the image data. In these cases, img2pdf only increases the filesize by the size
of the PDF container (typically around 500 to 700 bytes). Since data is only
copied and not re-encoded, img2pdf is also typically faster than other
solutions for these input formats.
For all other input types, img2pdf first has to transform the pixel data to
make it compatible with PDF. In most cases, the PNG Paeth filter is applied to
the pixel data. For monochrome input, CCITT Group 4 is used instead. Only for
CMYK input no filter is applied before finally applying flate compression.

%package help
Summary:	Development documents and examples for img2pdf
Provides:	python3-img2pdf-doc
%description help
Lossless conversion of raster images to PDF. You should use img2pdf if your
priorities are (in this order):
 1. **always lossless**: the image embedded in the PDF will always have the
    exact same color information for every pixel as the input
 2. **small**: if possible, the difference in filesize between the input image
    and the output PDF will only be the overhead of the PDF container itself
 3. **fast**: if possible, the input image is just pasted into the PDF document
    as-is without any CPU hungry re-encoding of the pixel data
Conventional conversion software (like ImageMagick) would either:
 1. not be lossless because lossy re-encoding to JPEG
 2. not be small because using wasteful flate encoding of raw pixel data
 3. not be fast because input data gets re-encoded
Another advantage of not having to re-encode the input (in most common
situations) is, that img2pdf is able to handle much larger input than other
software, because the raw pixel data never has to be loaded into memory.
The following table shows how img2pdf handles different input depending on the
input file format and image color space.
| Format                                | Colorspace                     | Result        |
| ------------------------------------- | ------------------------------ | ------------- |
| JPEG                                  | any                            | direct        |
| JPEG2000                              | any                            | direct        |
| PNG (non-interlaced, no transparency) | any                            | direct        |
| TIFF (CCITT Group 4)                  | monochrome                     | direct        |
| any                                   | any except CMYK and monochrome | PNG Paeth     |
| any                                   | monochrome                     | CCITT Group 4 |
| any                                   | CMYK                           | flate         |
For JPEG, JPEG2000, non-interlaced PNG and TIFF images with CCITT Group 4
encoded data, img2pdf directly embeds the image data into the PDF without
re-encoding it. It thus treats the PDF format merely as a container format for
the image data. In these cases, img2pdf only increases the filesize by the size
of the PDF container (typically around 500 to 700 bytes). Since data is only
copied and not re-encoded, img2pdf is also typically faster than other
solutions for these input formats.
For all other input types, img2pdf first has to transform the pixel data to
make it compatible with PDF. In most cases, the PNG Paeth filter is applied to
the pixel data. For monochrome input, CCITT Group 4 is used instead. Only for
CMYK input no filter is applied before finally applying flate compression.

%prep
%autosetup -n img2pdf-0.4.4

%build
%py3_build

%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
	find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
	find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
	find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
	find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
	find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .

%files -n python3-img2pdf -f filelist.lst
%dir %{python3_sitelib}/*

%files help -f doclist.lst
%{_docdir}/*

%changelog
* Fri Apr 07 2023 Python_Bot <Python_Bot@openeuler.org> - 0.4.4-1
- Package Spec generated