This commit is contained in:
20
docs/snippets/kotlin/ocr/image_preprocessing.md
Normal file
20
docs/snippets/kotlin/ocr/image_preprocessing.md
Normal file
@@ -0,0 +1,20 @@
|
||||
```kotlin title="Kotlin"
|
||||
import dev.kreuzberg.*
|
||||
import java.nio.file.Paths
|
||||
import java.util.Optional
|
||||
|
||||
fun main() {
|
||||
val images = ImageExtractionConfig.builder()
|
||||
.withExtractImages(true)
|
||||
.withTargetDpi(300)
|
||||
.withMaxImageDimension(4096)
|
||||
.build()
|
||||
|
||||
val config = ExtractionConfig.builder()
|
||||
.withImages(Optional.of(images))
|
||||
.build()
|
||||
|
||||
val result = Kreuzberg.extractFileSync(Paths.get("document.pdf"), null, config)
|
||||
println("Extracted images: ${result.images()?.size ?: 0}")
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user