[F] Vertical
This commit is contained in:
@@ -6,6 +6,7 @@ import android.graphics.Picture
|
|||||||
import android.graphics.Typeface
|
import android.graphics.Typeface
|
||||||
import androidx.core.content.res.ResourcesCompat
|
import androidx.core.content.res.ResourcesCompat
|
||||||
import com.ashampoo.kim.Kim
|
import com.ashampoo.kim.Kim
|
||||||
|
import com.ashampoo.kim.format.tiff.constant.TiffTag
|
||||||
import com.ashampoo.kim.model.MetadataUpdate
|
import com.ashampoo.kim.model.MetadataUpdate
|
||||||
import com.ashampoo.kim.model.TiffOrientation
|
import com.ashampoo.kim.model.TiffOrientation
|
||||||
import com.caverock.androidsvg.SVG
|
import com.caverock.androidsvg.SVG
|
||||||
@@ -32,7 +33,11 @@ suspend fun genSvg(template: String, imagePath: String): Pair<String, ExifResult
|
|||||||
val stream = ByteArrayOutputStream().also { qr.writeImage(it) }
|
val stream = ByteArrayOutputStream().also { qr.writeImage(it) }
|
||||||
|
|
||||||
// Check EXIF rotation: If it's vertical, rotate the image before embedding
|
// Check EXIF rotation: If it's vertical, rotate the image before embedding
|
||||||
if (exif.w < exif.h) imageData = Kim.update(imageData, MetadataUpdate.Orientation(TiffOrientation.ROTATE_RIGHT))
|
println("Width: ${exif.w}, Height: ${exif.h}, Orientation: ${exif.d.orientation}")
|
||||||
|
if (exif.w < exif.h) {
|
||||||
|
println("Vertical image, rotating...")
|
||||||
|
imageData = Kim.update(imageData, MetadataUpdate.Orientation(exif.d.orientation?.rotateRight() ?: TiffOrientation.ROTATE_RIGHT))
|
||||||
|
}
|
||||||
|
|
||||||
svg = svg.replace("2025-09-26 14:59", exif.dateTime)
|
svg = svg.replace("2025-09-26 14:59", exif.dateTime)
|
||||||
.replace("Nag<tspan x=\"1309.04px 1369.61px 1408.89px 1468.58px 1508.64px \" y=\"4531.84px 4531.84px 4531.84px 4531.84px 4531.84px \">atoro</tspan>, Saitama, Japan", exif.location)
|
.replace("Nag<tspan x=\"1309.04px 1369.61px 1408.89px 1468.58px 1508.64px \" y=\"4531.84px 4531.84px 4531.84px 4531.84px 4531.84px \">atoro</tspan>, Saitama, Japan", exif.location)
|
||||||
|
|||||||
Reference in New Issue
Block a user