From 6bbfc093885043abdfa18826511ee053e52d08fa Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 14 Oct 2026 18:54:48 +0200 Subject: Fifth commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- opening.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'opening.c') diff --git a/opening.c b/opening.c index 1552b18..54228b1 100644 --- a/opening.c +++ b/opening.c @@ -81,6 +81,18 @@ get_raster_dpi_option(GdkPixbuf *raster, const char *name, double *dpi) return 1; } +static int +parse_orientation(const char *s) +{ + char c; + if (!s) return 0; + while (isspace(*s)) s++; + c = *s; + if (!c) return 0; + while (isspace(*s)) s++; + return (!*s || c < '1' || c > '8') ? 0 : (int)c - '0'; +} + int load_image(struct file *file, int errors_to_stderr) { @@ -95,6 +107,7 @@ load_image(struct file *file, int errors_to_stderr) unsigned char *buffer = NULL; size_t size; int fd, ret = 1; + int orientation; if (!file) return 0; @@ -140,11 +153,17 @@ load_image(struct file *file, int errors_to_stderr) file->image.vector = vector; vector = NULL; + if (file->image.vector) { + /* TODO get dimensions and dpi from file->image.vector */ + } file->image.width = gdk_pixbuf_get_width(file->image.raster); file->image.height = gdk_pixbuf_get_height(file->image.raster); file->image.has_x_dpi = get_raster_dpi_option(file->image.raster, "x-dpi", &file->image.x_dpi); file->image.has_y_dpi = get_raster_dpi_option(file->image.raster, "y-dpi", &file->image.y_dpi); + orientation = parse_orientation(gdk_pixbuf_get_option(file->image.raster, "orientation")); + file->image.embedded_transformation = orientation_to_transformation(orientation); + if (file->exif_tags) { g_strfreev(file->exif_tags); file->exif_tags = NULL; -- cgit v1.3.1