mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Upgrade to libvips v8.13.0-rc1 (#3230)
* Switch from decompress-zip to extract-zip The former seems to hang when unzipping a ZIP64 file that uses the general purpose bit flag 3 as file entry. See: https://github.com/thejoshwolfe/yauzl#no-streaming-unzip-api * Prefer to call via static member instead Makes it clearer that a static method is being called. * `flatten-orange.jpg`: save without chroma subsampling To ensure no down-scaling of the Cr/Cb channels.
This commit is contained in:
committed by
GitHub
parent
e40a881ab4
commit
afc4c5bf79
@@ -366,32 +366,33 @@ namespace sharp {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (descriptor->createChannels > 0) {
|
||||
int const channels = descriptor->createChannels;
|
||||
if (channels > 0) {
|
||||
// Create new image
|
||||
if (descriptor->createNoiseType == "gaussian") {
|
||||
int const channels = descriptor->createChannels;
|
||||
image = VImage::new_matrix(descriptor->createWidth, descriptor->createHeight);
|
||||
std::vector<VImage> bands = {};
|
||||
bands.reserve(channels);
|
||||
for (int _band = 0; _band < channels; _band++) {
|
||||
bands.push_back(image.gaussnoise(
|
||||
descriptor->createWidth,
|
||||
descriptor->createHeight,
|
||||
VImage::option()->set("mean", descriptor->createNoiseMean)->set("sigma", descriptor->createNoiseSigma)));
|
||||
bands.push_back(VImage::gaussnoise(descriptor->createWidth, descriptor->createHeight, VImage::option()
|
||||
->set("mean", descriptor->createNoiseMean)
|
||||
->set("sigma", descriptor->createNoiseSigma)));
|
||||
}
|
||||
image = image.bandjoin(bands);
|
||||
image = VImage::bandjoin(bands).copy(VImage::option()->set("interpretation",
|
||||
channels < 3 ? VIPS_INTERPRETATION_B_W: VIPS_INTERPRETATION_sRGB));
|
||||
} else {
|
||||
std::vector<double> background = {
|
||||
descriptor->createBackground[0],
|
||||
descriptor->createBackground[1],
|
||||
descriptor->createBackground[2]
|
||||
};
|
||||
if (descriptor->createChannels == 4) {
|
||||
if (channels == 4) {
|
||||
background.push_back(descriptor->createBackground[3]);
|
||||
}
|
||||
image = VImage::new_matrix(descriptor->createWidth, descriptor->createHeight).new_from_image(background);
|
||||
image = VImage::new_matrix(descriptor->createWidth, descriptor->createHeight)
|
||||
.copy(VImage::option()->set("interpretation",
|
||||
channels < 3 ? VIPS_INTERPRETATION_B_W : VIPS_INTERPRETATION_sRGB))
|
||||
.new_from_image(background);
|
||||
}
|
||||
image.get_image()->Type = image.guess_interpretation();
|
||||
image = image.cast(VIPS_FORMAT_UCHAR);
|
||||
imageType = ImageType::RAW;
|
||||
} else {
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif /*HAVE_CONFIG_H*/
|
||||
#include <vips/intl.h>
|
||||
|
||||
#include <vips/vips8>
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif /*HAVE_CONFIG_H*/
|
||||
#include <vips/intl.h>
|
||||
|
||||
#include <vips/vips8>
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif /*HAVE_CONFIG_H*/
|
||||
#include <vips/intl.h>
|
||||
|
||||
#include <vips/vips8>
|
||||
|
||||
@@ -733,7 +732,7 @@ VImage::write_to_buffer( const char *suffix, void **buf, size_t *size,
|
||||
set( "in", *this )->
|
||||
set( "target", target ) );
|
||||
|
||||
g_object_get( target.get_target(), "blob", &blob, NULL );
|
||||
g_object_get( target.get_target(), "blob", &blob, (void *) NULL );
|
||||
}
|
||||
else if( (operation_name = vips_foreign_find_save_buffer( filename )) ) {
|
||||
call_option_string( operation_name, option_string,
|
||||
@@ -778,6 +777,32 @@ VImage::write_to_target( const char *suffix, VTarget target,
|
||||
set( "target", target ) );
|
||||
}
|
||||
|
||||
VRegion
|
||||
VImage::region() const
|
||||
{
|
||||
return VRegion::new_from_image( *this );
|
||||
}
|
||||
|
||||
VRegion
|
||||
VImage::region( VipsRect *rect ) const
|
||||
{
|
||||
VRegion region = VRegion::new_from_image( *this );
|
||||
|
||||
region.prepare( rect );
|
||||
|
||||
return region;
|
||||
}
|
||||
|
||||
VRegion
|
||||
VImage::region( int left, int top, int width, int height ) const
|
||||
{
|
||||
VRegion region = VRegion::new_from_image( *this );
|
||||
|
||||
region.prepare( left, top, width, height );
|
||||
|
||||
return region;
|
||||
}
|
||||
|
||||
#include "vips-operators.cpp"
|
||||
|
||||
std::vector<VImage>
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif /*HAVE_CONFIG_H*/
|
||||
#include <vips/intl.h>
|
||||
|
||||
#include <vips/vips8>
|
||||
|
||||
|
||||
27
src/libvips/cplusplus/VRegion.cpp
Normal file
27
src/libvips/cplusplus/VRegion.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
// Object part of VRegion class
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif /*HAVE_CONFIG_H*/
|
||||
|
||||
#include <vips/vips8>
|
||||
|
||||
#include <vips/debug.h>
|
||||
|
||||
VIPS_NAMESPACE_START
|
||||
|
||||
VRegion
|
||||
VRegion::new_from_image( VImage image )
|
||||
{
|
||||
VipsRegion *region;
|
||||
|
||||
if( !(region = vips_region_new( image.get_image() )) ) {
|
||||
throw VError();
|
||||
}
|
||||
|
||||
VRegion out( region );
|
||||
|
||||
return( out );
|
||||
}
|
||||
|
||||
VIPS_NAMESPACE_END
|
||||
@@ -1,5 +1,4 @@
|
||||
// bodies for vips operations
|
||||
// Mon Nov 1 03:31:09 PM CET 2021
|
||||
// this file is generated automatically, do not edit!
|
||||
|
||||
VImage VImage::CMC2LCh( VOption *options ) const
|
||||
@@ -943,6 +942,14 @@ VipsBlob *VImage::dzsave_buffer( VOption *options ) const
|
||||
return( buffer );
|
||||
}
|
||||
|
||||
void VImage::dzsave_target( VTarget target, VOption *options ) const
|
||||
{
|
||||
call( "dzsave_target",
|
||||
(options ? options : VImage::option())->
|
||||
set( "in", *this )->
|
||||
set( "target", target ) );
|
||||
}
|
||||
|
||||
VImage VImage::embed( int x, int y, int width, int height, VOption *options ) const
|
||||
{
|
||||
VImage out;
|
||||
@@ -3521,6 +3528,14 @@ VipsBlob *VImage::tiffsave_buffer( VOption *options ) const
|
||||
return( buffer );
|
||||
}
|
||||
|
||||
void VImage::tiffsave_target( VTarget target, VOption *options ) const
|
||||
{
|
||||
call( "tiffsave_target",
|
||||
(options ? options : VImage::option())->
|
||||
set( "in", *this )->
|
||||
set( "target", target ) );
|
||||
}
|
||||
|
||||
VImage VImage::tilecache( VOption *options ) const
|
||||
{
|
||||
VImage out;
|
||||
|
||||
@@ -668,7 +668,7 @@ class PipelineWorker : public Napi::AsyncWorker {
|
||||
xs.push_back(left);
|
||||
ys.push_back(top);
|
||||
}
|
||||
image = image.composite(images, modes, VImage::option()->set("x", xs)->set("y", ys));
|
||||
image = VImage::composite(images, modes, VImage::option()->set("x", xs)->set("y", ys));
|
||||
}
|
||||
|
||||
// Reverse premultiplication after all transformations:
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "stats.h"
|
||||
|
||||
static void* sharp_vips_init(void*) {
|
||||
g_setenv("VIPS_MIN_STACK_SIZE", "2m", FALSE);
|
||||
vips_init("sharp");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user