Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add new comparison method rgb_difference that resembles arithmetical … #462

Closed
wants to merge 6 commits into from

Conversation

andk
Copy link
Contributor

@andk andk commented Dec 26, 2020

One thing I'm not so sure about is the name of the function. Apart from that I really need this functionality quite often and hate to use a perl version of it because perl is so much slower.

I hope you like it. If not, let me know whether I can improve it somehow.

Best wishes, etc,,,

filters.im Outdated Show resolved Hide resolved
filters.im Outdated Show resolved Hide resolved
lib/Imager/Filters.pod Show resolved Hide resolved
andk added 4 commits February 25, 2021 15:07
…difference per channel

- the difference of two identical images is a black image
- any pixel in the resulting image that is not black indicates where there is a difference
- transparency is ignored
Copy link
Owner

@tonycoz tonycoz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One other issue is the handling of the alpha channel in the output image. As far as I can tell, if the input image has no alpha channel it adds one, and then whether or not the input images had alpha channels, sets that output alpha channel to max opacity.

A non-alpha channel image is treated as having max opacity, so why add the alpha channel?

filters.im Outdated Show resolved Hide resolved
filters.im Outdated Show resolved Hide resolved
@tonycoz
Copy link
Owner

tonycoz commented Mar 2, 2021

I was looking at applying this and fixing the issues myself, but got caught up in the alpha thing.

If you like I can apply a fixed version of the change and eliminate the alpha channel myself, assuming that was the intended behaviour.

@andk
Copy link
Contributor Author

andk commented Mar 2, 2021 via email

andk added 2 commits March 6, 2021 05:00
- posted at tonycoz#462 (comment)
- test xt/x90cmpversion.t fails now
- "opaque" not needed anymore
@tonycoz
Copy link
Owner

tonycoz commented Mar 10, 2021

thanks, squashed and applied as dcdafbb

@tonycoz tonycoz closed this Mar 10, 2021
mtremer pushed a commit to ipfire/ipfire-2.x that referenced this pull request Dec 12, 2024
- Update from version 1.012 (2020) to 1.024
- Update of rootfile
- Addition of patch to fix inclusion of t1tables.h for FT_Has_PS_Glyph_Names which is
   no longer pulled in by ftmm.h since FreeType 2.13.3
- Changelog
    1.024
	 - TIFF: improve reporting from a test on failure.
	 - TIFF: support back to libtiff 4.0.8, for compatibility with RHEL
	   and its clones.
	   tonycoz/imager#527
    1.023
	 - TIFF: don't read after free when looking up a compression codec
	   by the libtiff defined name,
	   tonycoz/imager#524
    1.022
	 - TIFF: We can no longer be lazy in implementing the size callback.
	   tonycoz/imager#522
	   https://bugs.debian.org/1057270
    1.021
	Several TIFF changes:
	 - require libtiff 4.1.0 or later
	 - add buildversion, builddate and libversion methods
	 - add the codecs method which fetches a list of available TIFF
	   compression codes
	 - avoid deprecation warnings from libtiff about using the old
	   libtiff defined integer types
	 - require vsnprintf() (C99)
	 - remove my adaption of TIFFReadRGBATile() since libtiff now provides
	   TIFFReadRGBATileExt() which can do the same thing
	 - use pkg-config to find libtiff if possible
	 - for sufficiently modern libtiff (4.5.0) use TIFFClientOptions to
	   specify the warning and error handlers, this means we no longer
	   need a mutex for 4.5.0 and later.
	 - collect warnings using a buffer chain instead of custom allocation
	   code.
	 - include the "module" name (typically a libtiff function name) when
	   recording libtiff warnings.
	 - add CI to test Imager::File::TIFF against libtiff 4.1.0 through 4.6.0
	 - other minor fixes
	Other changes:
	 - prevent CodeQL from complaining about an implicit conversion to
	   unsigned char
    1.020
	 - masked(): disallow negative width/height masked images
	 - masked(): adjust source corners as bottom right relative if they
	   are negative.
	 - masked(): reject image source corners where either co-ordinate is
	   negative after the above adjustment.
	 - Imager::Files: update external image file support modules list
	 - internal test: don't fail on Imager::File::APNG link
	 - disable Imager::Font::T1 and Freetype 1.x fonts by default.
	   Unpatched t1lib simply doesn't work on 64 bit systems, and no-one
	   ships the patched version anymore.
	   tonycoz/imager#510
    1.019
	 - fix palette/transparency table generation when writing paletted PNG
	   images with tranparency.  This happened to work for the test case,
	   but the mechanism used to generate the palette order preserved most
	   palette index positions, which hid the problem with actually
	   generating the PLTE and tRNS chunks.
	   tonycoz/imager#499
	 - added lowish-level read() and write() class methods to
	   Imager::File::PNG, these are mostly intended for
	   Imager::File::APNG, but are documented and usable elsewhere.
	 - document in Imager::Install how to install Imager without any of
	   the bundled-but-also-on-CPAN modules being installed.
	   tonycoz/imager#498
    1.018
	 - skip trying to produce deprecation warnings before perl 5.14, since
	   that doesn't support custom warning categories within a package.
	   This prevents pointless failures on these old versions of perl.
    1.017
	Bug fix:
	 - fix a one bytes underallocation for Imager::TrimColorList.  On
	   older perls this could lead to writing a zero byte one past the end
	   of the allocated block.
	Documentation:
	 - expand on why you might want to call Imager->preload() and that you
	   probably don't need to.
    1.016
	Upcoming backward incompatible changes:
	 - deprecate setting/deleting tags by code.  If this causes you a
	   problem please open an issue.  You can disable the warning produced
	   with:
	    no warnings 'Imager::tagcodes';
	 - deprecate image channel masks.  If this causes you a problem please
	   open an issue.  You can disable the warning produced with:
	    no warnings 'Imager::channelmask';
	If you use either of these features please let me know.
	Minor features:
	 - add magic/extension support for AVIF files, see Imager::File::AVIF
	   on CPAN.
	 - treat an unknown extension of two or more characters as a potential
	   file type on write.
	Bug fixes:
	 - prevent a possible undefined value warning from t/t10jpeg.t
	 - update MANIFEST.SKIPs, update MANIFESTs and improve MANIFEST testing.
	 - TGA: failing to read in the palette of a paletted TGA file would
	   leak memory.
	 - JPEG: supplying invalid values for the new JPEG write tags could
	   leak memory.
	 - PNG: fix validation of Latin1 only tags when writing PNGs.
	   (detected by clang)
	 - matrix_transform: correctly use fabs() instead of abs() on floating
	   point values when deciding whether to divide for a perspective
	   transform. (detected by clang)
	 - fix the i_poly_aa_cfill_m() API macro
	Cage cleaning:
	 - eliminate IO::File usage from the Imager code base
	 - fix a type error harmlessly ignored by gcc but found by clang
	 - eliminate memory leaks in sub-module Makefile.PL probe test code to
	   allow the probes to succeed under LeakSanitizer.
	 - BMP: fix some otherwise harmless clang warnings
	 - remove some code meant to work around some unspecified old Solaris
	   linker bug.
	 - i_noise: prevent a harmless conversion warning from clang
	 - fountain fill/filter: limit ssample_param to 1000 to simplify code.
    1.015
	 - rename the "virtual" member of i_img to "isvirtual" to allow the
	   API to be used from C++, this may break source compatibility, using
	   the i_img_virtual() accessor is backward compatible.
	 - add cookbook entry to populating an image from raw RGB samples
	   tonycoz/imager#471
	 - Imager::Probe now puts the existing value of PKG_CONFIG_PATH at the
	   front of the PKG_CONFIG_PATH used when it calls pkg-config.
	 - setup CodeQL workflow and fix detected warnings
	JPEG updates:
	 - detect libjpeg (of whichever variety) via pkg-config if possible
	 - add specific support for mozjpeg (turn its optimization off by
	   default so tests pass.)
	 - add libjpeg_version(), is_mozjpeg(), is_turbojpeg() and
	   has_arith_coding() methods
	 - add jpeg_compress_profile output tag, which only matters for
	   mozjpeg
	 - the libjpeg_version() method replaces the old
	   Imager::File::JPEG::i_libjpeg_version() function, and the format
	   has changed.
	 - various obscure jpeg output controls:
	   - add support for JPEG arithmetic coding when the supplied libjpeg
	     supports it.  Note that not all JPEG decoders can handle arithmetic
	     coded JPEGs.
	   - add support for disabling the JFIF header for JPEG files using the
	     jpeg_jfif tag.
	   - add support for smoothing to eliminate dithering noise (like cjpeg
	     -smooth) using the jpeg_smooth tag.
	   - add support for producing JPEG restart markers (like cjpeg -restart
	     N), using the jpeg_restart tag.
	   - add control over subsample for JPEG (like the cjpeg -sample
	     parameter) using the jpeg_sample tag
	   - added tags for the rest of the MozJPEG API parameters.
	   - add jpeg_tune tag, corresponding to the MozJPEG cjpeg -tune-*
	     options.
    1.014
	Bug fixes:
	 - fix failed to build on non-threaded perls.
	   tonycoz/imager#472
	 - when writing a paletted image with an alpha channel to PNG only
	   set the tRNS chunk if the image has transparent colours.  With
	   older libpng this could add an erroneous tRNS chunk (or possibly
	   undefined behaviour if I understand the libpng code).
	   tonycoz/imager#459
	Features:
	 - Imager::Color and Imager::Color::Float objects can now be created
	   from CSS style rgb(...) strings.
	   tonycoz/imager#463
	 - added the as_css_rgb() method to both Imager::Color and
	   Imager::Color::Float to format the supplied color as a CSS style
	   rgb() string.
	   tonycoz/imager#463
	 - Imager::Color and Imager::Color::Float objects can now be created
	   (copied) or set from other Imager::Color or Imager::Color::Float
	   objects.
    1.013
	 - added rgb_difference() method
	   Thanks to Andreas König
	   tonycoz/imager#462
	 - update ppport.h to prevent a redefinition diagnostic
	 - update bug tracker URLs to point at github
	   tonycoz/imager#466
	 - update some other bug tracker URLs too.
	 - add the trim() and trim_rect() methods, to trim borders off an
	   image.
	 - add the as_float() method to Imager::Color and the as_8bit() method
	   to Imager::Color::Float to convert between the two types.
	 - update ppport.h to avoid a diagnostic in more modern perls.
	 - add detection for HEIF, JPEG XL and QOI image formats

Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants