Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .run/Run samples.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<option name="MAIN_CLASS_NAME" value="vipsffm.SampleRunner" />
<module name="vips-ffm.sample.main" />
<option name="PROGRAM_PARAMETERS" value="-Dvipsffm.libpath.vips.override=/opt/homebrew/lib/libvips.dylib -Dvipsffm.libpath.glib.override=/opt/homebrew/lib/libglib-2.0.dylib -Dvipsffm.libpath.gobject.override=/opt/homebrew/lib/libgobject-2.0.dylib" />
<shortenClasspath name="NONE" />
<option name="VM_PARAMETERS" value="--enable-native-access=ALL-UNNAMED" />
<option name="VM_PARAMETERS" value="--enable-native-access=ALL-UNNAMED -Dvipsffm.libpath.vips.override=/opt/homebrew/lib/libvips.dylib -Dvipsffm.libpath.glib.override=/opt/homebrew/lib/libglib-2.0.dylib -Dvipsffm.libpath.gobject.override=/opt/homebrew/lib/libgobject-2.0.dylib" />
<method v="2">
<option name="Make" enabled="true" />
</method>
Expand Down
2 changes: 0 additions & 2 deletions sample/src/main/kotlin/vipsffm/SampleRunner.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import vipsffm.sample.VImageJoinSample
import vipsffm.sample.VImageFromMemoryToMemorySample
import vipsffm.sample.VImageGetPointSample
import vipsffm.sample.VImageMatrixSample
import vipsffm.sample.VImageStaticThumbnailSample
import vipsffm.sample.VOptionHyphenSample
import vipsffm.sample.VSourceTargetSample
import vipsffm.sample.VTargetToFileSample
Expand Down Expand Up @@ -53,7 +52,6 @@ object SampleRunner {
VImageJoinSample,
VImageFromBytesSample,
VImageStreamSample,
VImageStaticThumbnailSample,
VImageGetPagesSample,
VImageGetPointSample,
HelperGetSetMetadataSample,
Expand Down
6 changes: 3 additions & 3 deletions sample/src/main/kotlin/vipsffm/sample/VImageCachingSample.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ object VImageCachingSample: RunnableSample {
val outputPath = workingDirectory.resolve("rabbit_chain.jpg")

(0 ..< 3).forEach { _ ->
val image = VImage.newFromFile(
val image = VImage.thumbnail(
arena,
"sample/src/main/resources/sample_images/rabbit.jpg"
"sample/src/main/resources/sample_images/rabbit.jpg",
400
)
.thumbnailImage(400)
.flip(VipsDirection.DIRECTION_VERTICAL)
.autorot()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,9 @@ object VImageCreateThumbnailSample: RunnableSample {
val logger = LoggerFactory.getLogger(VImageCreateThumbnailSample::class.java)

override fun run(arena: Arena, workingDirectory: Path): Result<Unit> {
val sourceImage = VImage.newFromFile(
val thumbnail = VImage.thumbnail(
arena,
"sample/src/main/resources/sample_images/rabbit.jpg"
)
val sourceWidth = sourceImage.width
val sourceHeight = sourceImage.height
logger.info("source image size: $sourceWidth x $sourceHeight")

val outputPath = workingDirectory.resolve("rabbit_copy.jpg")
sourceImage.writeToFile(outputPath.absolutePathString())

val thumbnail = sourceImage.thumbnailImage(
"sample/src/main/resources/sample_images/rabbit.jpg",
400,
VipsOption.Boolean("auto-rotate", true) // example of an option
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ object VImageFromBytesSample: RunnableSample {
val path = Path.of("sample/src/main/resources/sample_images/rabbit.jpg")
val bytes = Files.readAllBytes(path)
val image = VImage.newFromBytes(arena, bytes)
.thumbnailImage(400)
.thumbnailImage(400) // prefer VImage.thumbnail if possible

val outputPath = workingDirectory.resolve("rabbit_copy.jpg")
image.writeToFile(outputPath.absolutePathString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ object VImageFromMemoryToMemorySample : RunnableSample {

override fun run(arena: Arena, workingDirectory: Path): Result<Unit> {
val path = Path.of("sample/src/main/resources/sample_images/rabbit.jpg")
val image = VImage.newFromFile(arena, path.absolutePathString())
.thumbnailImage(400)
val image = VImage.thumbnail(
arena,
path.absolutePathString(),
400
)

val bands = VipsHelper.image_get_bands(image.unsafeStructAddress)
val width = image.width
Expand Down

This file was deleted.

Loading