Skip to content

Commit

Permalink
Support vips 8.16.0 (#455)
Browse files Browse the repository at this point in the history
- This removes the usage of the deprecated VIPS_FOREIGN_JPEG_SUBSAMPLE
  enum, instead using the VIPS_FOREIGN_SUBSAMPLE_ON enum in it's place
  • Loading branch information
cdimitroulas authored Jan 8, 2025
1 parent 7c64776 commit 859c51d
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion vips/foreign.c
Original file line number Diff line number Diff line change
@@ -526,7 +526,7 @@ static SaveParams defaultSaveParams = {
.stripMetadata = FALSE,

.jpegOptimizeCoding = FALSE,
.jpegSubsample = VIPS_FOREIGN_JPEG_SUBSAMPLE_ON,
.jpegSubsample = VIPS_FOREIGN_SUBSAMPLE_ON,
.jpegTrellisQuant = FALSE,
.jpegOvershootDeringing = FALSE,
.jpegOptimizeScans = FALSE,
12 changes: 6 additions & 6 deletions vips/foreign.go
Original file line number Diff line number Diff line change
@@ -19,10 +19,10 @@ type SubsampleMode int

// SubsampleMode enum correlating to libvips subsample modes
const (
VipsForeignSubsampleAuto SubsampleMode = C.VIPS_FOREIGN_JPEG_SUBSAMPLE_AUTO
VipsForeignSubsampleOn SubsampleMode = C.VIPS_FOREIGN_JPEG_SUBSAMPLE_ON
VipsForeignSubsampleOff SubsampleMode = C.VIPS_FOREIGN_JPEG_SUBSAMPLE_OFF
VipsForeignSubsampleLast SubsampleMode = C.VIPS_FOREIGN_JPEG_SUBSAMPLE_LAST
VipsForeignSubsampleAuto SubsampleMode = C.VIPS_FOREIGN_SUBSAMPLE_AUTO
VipsForeignSubsampleOn SubsampleMode = C.VIPS_FOREIGN_SUBSAMPLE_ON
VipsForeignSubsampleOff SubsampleMode = C.VIPS_FOREIGN_SUBSAMPLE_OFF
VipsForeignSubsampleLast SubsampleMode = C.VIPS_FOREIGN_SUBSAMPLE_LAST
)

// ImageType represents an image type
@@ -358,7 +358,7 @@ func vipsSaveJPEGToBuffer(in *C.VipsImage, params JpegExportParams) ([]byte, err
p.quality = C.int(params.Quality)
p.interlace = C.int(boolToInt(params.Interlace))
p.jpegOptimizeCoding = C.int(boolToInt(params.OptimizeCoding))
p.jpegSubsample = C.VipsForeignJpegSubsample(params.SubsampleMode)
p.jpegSubsample = C.VipsForeignSubsample(params.SubsampleMode)
p.jpegTrellisQuant = C.int(boolToInt(params.TrellisQuant))
p.jpegOvershootDeringing = C.int(boolToInt(params.OvershootDeringing))
p.jpegOptimizeScans = C.int(boolToInt(params.OptimizeScans))
@@ -467,7 +467,7 @@ func vipsSaveJP2KToBuffer(in *C.VipsImage, params Jp2kExportParams) ([]byte, err
p.jp2kLossless = C.int(boolToInt(params.Lossless))
p.jp2kTileWidth = C.int(params.TileWidth)
p.jp2kTileHeight = C.int(params.TileHeight)
p.jpegSubsample = C.VipsForeignJpegSubsample(params.SubsampleMode)
p.jpegSubsample = C.VipsForeignSubsample(params.SubsampleMode)

return vipsSaveToBuffer(p)
}
2 changes: 1 addition & 1 deletion vips/foreign.h
Original file line number Diff line number Diff line change
@@ -84,7 +84,7 @@ typedef struct SaveParams {

// JPEG
BOOL jpegOptimizeCoding;
VipsForeignJpegSubsample jpegSubsample;
VipsForeignSubsample jpegSubsample;
BOOL jpegTrellisQuant;
BOOL jpegOvershootDeringing;
BOOL jpegOptimizeScans;

0 comments on commit 859c51d

Please sign in to comment.