Last active
May 31, 2018 20:12
-
-
Save duanebester/8fc123732477cee2e3517d37ec13612b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val route = | |
| path("image" / "process") { | |
| post { | |
| fileUpload("fileUpload") { | |
| case (_, fileStream) => | |
| val inputStream = fileStream.runWith(StreamConverters.asInputStream()) | |
| val image: BufferedImage = ImageIO.read(inputStream) | |
| val preProcessed: Source[ByteString, NotUsed] = Source | |
| .single(image) | |
| .via(imageToBinaryImage) | |
| .via(imageDeSkew()) | |
| .via(imageWriter()) | |
| complete(HttpEntity(ContentType.Binary(MediaTypes.`image/png`), preProcessed)) | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment