Created attachment 164562 [details] Left: unrotated image Right: twice rotated image with the artifacts on right and bottom edges SUMMARY When I rotate a jpg image using either Gwenview or digiKam, the image will have thin strips of the wrong side of the image on one or two of its edges. An example can be seen in the attached image. STEPS TO REPRODUCE using Gwenview 1. Take a full screen screenshot with Spectacle and save as a JPEG Image. (This issue doesn't happen in either Gwenview or digiKam if it is a PNG.) 2. Open the saved jpg with Gwenview, the image looks normal. 3. Using the Gwenview editing tools, rotate the image right twice. 4. Save the changes, and close the Gwenview window. 5. Reopen the image with Gwenview. STEPS TO REPRODUCE using digiKam 1. Take a full screen screenshot with Spectacle and save as a JPEG Image. (This issue doesn't happen in either Gwenview or digiKam if it is a PNG.) 2. Place the image in an album scanned by digiKam. 3. Open the album you put the image in with digiKam in thumbnail mode. 4. Double click the image to open it in preview mode.. 5. Click one of the rotate buttons twice to achieve a 180 degree turn. OBSERVED RESULT The image now has thin strips of the opposite side of the image on the right and bottom. EXPECTED RESULT The image should be rotated, and otherwise unaltered. SOFTWARE/OS VERSIONS Linux/KDE Plasma: KDE Plasma Version: 5.27.10 KDE Frameworks Version: 5.113.0 Qt Version: 5.15.11 ADDITIONAL INFORMATION Output of inxi --admin --verbosity=7 --filter --no-host --width System: Kernel: 6.6.8-2-MANJARO arch: x86_64 bits: 64 compiler: gcc v: 13.2.1 clocksource: tsc available: hpet,acpi_pm parameters: BOOT_IMAGE=/boot/vmlinuz-6.6-x86_64 root=UUID=12ee8f3b-ad2f-4864-b078-84906c387d3e rw quiet splash udev.log_priority=3 Desktop: KDE Plasma v: 5.27.10 tk: Qt v: 5.15.11 wm: kwin_x11 vt: 2 dm: SDDM Distro: Manjaro Linux base: Arch Linux Machine: Type: Desktop System: Apple product: iMac14,3 v: 1.0 serial: <superuser required> Chassis: type: 13 v: Mac-77EB7D7DAF985301 serial: <superuser required> Mobo: Apple model: Mac-77EB7D7DAF985301 v: iMac14,3 serial: <superuser required> UEFI: Apple v: 139.0.0.0.0 date: 06/13/2019 Battery: Message: No system battery data found. Is one present? Memory: System RAM: total: 8 GiB available: 7.7 GiB used: 4.6 GiB (59.7%) RAM Report: permissions: Unable to run dmidecode. Root privileges required. CPU: Info: model: Intel Core i5-4570S bits: 64 type: MCP arch: Haswell gen: core 4 level: v3 note: check built: 2013-15 process: Intel 22nm family: 6 model-id: 0x3C (60) stepping: 3 microcode: 0x28 Topology: cpus: 1x cores: 4 smt: <unsupported> cache: L1: 256 KiB desc: d-4x32 KiB; i-4x32 KiB L2: 1024 KiB desc: 4x256 KiB L3: 6 MiB desc: 1x6 MiB Speed (MHz): avg: 807 high: 829 min/max: 800/3600 scaling: driver: intel_cpufreq governor: schedutil cores: 1: 800 2: 800 3: 829 4: 800 bogomips: 23156 Flags: abm acpi aes aperfmperf apic arat arch_perfmon avx avx2 bmi1 bmi2 bts clflush cmov constant_tsc cpuid cpuid_fault cx16 cx8 de ds_cpl dtes64 dtherm dts epb ept ept_ad erms est f16c flexpriority flush_l1d fma fpu fsgsbase fxsr ht ibpb ibrs ida invpcid lahf_lm lm mca mce md_clear mmx monitor movbe msr mtrr nonstop_tsc nopl nx pae pat pbe pcid pclmulqdq pdcm pdpe1gb pebs pge pln pni popcnt pse pse36 pti pts rdrand rdtscp rep_good sdbg sep smep smx ss ssbd sse sse2 sse4_1 sse4_2 ssse3 stibp syscall tm tm2 tpr_shadow tsc tsc_adjust tsc_deadline_timer vme vmx vnmi vpid x2apic xsave xsaveopt xtopology xtpr Vulnerabilities: Type: gather_data_sampling status: Not affected Type: itlb_multihit status: KVM: VMX disabled Type: l1tf mitigation: PTE Inversion; VMX: conditional cache flushes, SMT disabled Type: mds mitigation: Clear CPU buffers; SMT disabled Type: meltdown mitigation: PTI Type: mmio_stale_data status: Unknown: No mitigations Type: retbleed status: Not affected Type: spec_rstack_overflow status: Not affected Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via prctl Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer sanitization Type: spectre_v2 mitigation: Retpolines, IBPB: conditional, IBRS_FW, STIBP: disabled, RSB filling, PBRSB-eIBRS: Not affected Type: srbds mitigation: Microcode Type: tsx_async_abort status: Not affected Graphics: Device-1: NVIDIA GK107M [GeForce GT 750M Mac Edition] vendor: Apple driver: nouveau v: kernel non-free: series: 470.xx+ status: legacy-active (EOL~2024-09-xx) arch: Kepler code: GKxxx process: TSMC 28nm built: 2012-2018 pcie: gen: 1 speed: 2.5 GT/s lanes: 16 link-max: gen: 3 speed: 8 GT/s ports: active: DP-1 empty: DP-2,DP-3 bus-ID: 01:00.0 chip-ID: 10de:0fe9 class-ID: 0300 temp: 44.0 C Device-2: Apple FaceTime HD Camera (Built-in) driver: uvcvideo type: USB rev: 2.0 speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 1-7:3 chip-ID: 05ac:8511 class-ID: 0e02 serial: <filter> Display: x11 server: X.Org v: 21.1.10 compositor: kwin_x11 driver: X: loaded: modesetting alternate: fbdev,vesa dri: nouveau gpu: nouveau display-ID: :0 screens: 1 Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.00x11.22") s-diag: 582mm (22.93") monitors: <missing: xrandr> Monitor-1: DP-1 model: Apple iMac built: 2012 res: 1920x1080 dpi: 103 gamma: 1.2 size: 475x267mm (18.7x10.51") diag: 545mm (21.5") ratio: 16:9 modes: max: 1920x1080 min: 960x540 API: EGL v: 1.5 hw: drv: nvidia nouveau platforms: device: 0 drv: nouveau device: 1 drv: swrast gbm: drv: nouveau surfaceless: drv: nouveau x11: drv: nouveau inactive: wayland API: OpenGL v: 4.5 compat-v: 4.3 vendor: mesa v: 23.1.9-manjaro1.1 glx-v: 1.4 direct-render: yes renderer: NVE7 device-ID: 10de:0fe9 memory: 991.2 MiB unified: no API: Vulkan Message: No Vulkan data available. Audio: Device-1: Intel 8 Series/C220 Series High Definition Audio driver: snd_hda_intel v: kernel bus-ID: 00:1b.0 chip-ID: 8086:8c20 class-ID: 0403 Device-2: NVIDIA GK107 HDMI Audio driver: snd_hda_intel v: kernel pcie: gen: 1 speed: 2.5 GT/s lanes: 16 link-max: gen: 3 speed: 8 GT/s bus-ID: 01:00.1 chip-ID: 10de:0e1b class-ID: 0403 API: ALSA v: k6.6.8-2-MANJARO status: kernel-api with: aoss type: oss-emulator tools: alsactl,alsamixer,amixer Server-1: JACK v: 1.9.22 status: off tools: N/A Server-2: PipeWire v: 1.0.0 status: active with: 1: pipewire-pulse status: active 2: wireplumber status: active 3: pipewire-alsa type: plugin tools: pactl,pw-cat,pw-cli,wpctl Network: Device-1: Broadcom BCM4360 802.11ac Dual Band Wireless Network Adapter vendor: Apple driver: bcma-pci-bridge v: N/A modules: bcma pcie: gen: 1 speed: 2.5 GT/s lanes: 1 bus-ID: 03:00.0 chip-ID: 14e4:43a0 class-ID: 0280 Device-2: Broadcom NetXtreme BCM57766 Gigabit Ethernet PCIe driver: tg3 v: kernel pcie: gen: 1 speed: 2.5 GT/s lanes: 1 port: N/A bus-ID: 04:00.0 chip-ID: 14e4:1686 class-ID: 0200 IF: enp4s0f0 state: up speed: 1000 Mbps duplex: full mac: <filter> IP v4: <filter> type: dynamic noprefixroute scope: global broadcast: <filter> IP v6: <filter> type: dynamic noprefixroute scope: global IP v6: <filter> type: dynamic noprefixroute scope: global IP v6: <filter> type: noprefixroute scope: link WAN IP: <filter> Bluetooth: Device-1: Apple Bluetooth Host Controller driver: btusb v: 0.8 type: USB rev: 2.0 speed: 12 Mb/s lanes: 1 mode: 1.1 bus-ID: 1-8.3:8 chip-ID: 05ac:828d class-ID: fe01 Report: rfkill ID: hci0 rfk-id: 0 state: up address: see --recommends Logical: Message: No logical block device data found. RAID: Message: No RAID data found. Drives: Local Storage: total: 1.82 TiB used: 362.75 GiB (19.5%) SMART Message: Unable to run smartctl. Root privileges required. ID-1: /dev/sda maj-min: 8:0 vendor: Apple model: HDD HTS541010A9E662 size: 931.51 GiB block-size: physical: 4096 B logical: 512 B speed: 3.0 Gb/s tech: HDD rpm: 5400 serial: <filter> fw-rev: B5D0 scheme: GPT ID-2: /dev/sdb maj-min: 8:16 vendor: Western Digital model: WD My Passport 264F size: 931.48 GiB block-size: physical: 512 B logical: 512 B type: USB rev: 3.2 spd: 5 Gb/s lanes: 1 mode: 3.2 gen-1x1 tech: N/A serial: <filter> fw-rev: 2011 scheme: GPT Message: No optical or floppy data found. Partition: ID-1: / raw-size: 931.19 GiB size: 915.49 GiB (98.32%) used: 362.75 GiB (39.6%) fs: ext4 dev: /dev/sdb2 maj-min: 8:18 label: N/A uuid: 12ee8f3b-ad2f-4864-b078-84906c387d3e ID-2: /boot/efi raw-size: 300 MiB size: 299.4 MiB (99.80%) used: 296 KiB (0.1%) fs: vfat dev: /dev/sdb1 maj-min: 8:17 label: N/A uuid: 0E26-2BDC Swap: Alert: No swap data was found. Unmounted: ID-1: /dev/sda1 maj-min: 8:1 size: 200 MiB fs: vfat label: EFI uuid: 67E3-17ED ID-2: /dev/sda2 maj-min: 8:2 size: 931.32 GiB fs: apfs label: N/A uuid: 10dcfc80-b03a-485a-8e90-b16a2864a324 USB: Hub-1: 1-0:1 info: hi-speed hub with single TT ports: 14 rev: 2.0 speed: 480 Mb/s (57.2 MiB/s) lanes: 1 mode: 2.0 chip-ID: 1d6b:0002 class-ID: 0900 Hub-2: 1-5:2 info: Apple Hub in Aluminum Keyboard ports: 3 rev: 2.0 speed: 480 Mb/s (57.2 MiB/s) lanes: 1 mode: 2.0 power: 300mA chip-ID: 05ac:1006 class-ID: 0900 Device-1: 1-5.2:4 info: Apple Aluminium Keyboard (ANSI) type: keyboard,HID driver: apple,usbhid interfaces: 2 rev: 2.0 speed: 1.5 Mb/s (183 KiB/s) lanes: 1 mode: 1.0 power: 20mA chip-ID: 05ac:024f class-ID: 0300 Device-2: 1-7:3 info: Apple FaceTime HD Camera (Built-in) type: video driver: uvcvideo interfaces: 3 rev: 2.0 speed: 480 Mb/s (57.2 MiB/s) lanes: 1 mode: 2.0 power: 500mA chip-ID: 05ac:8511 class-ID: 0e02 serial: <filter> Hub-3: 1-8:5 info: Broadcom BCM2046B1 USB 2.0 Hub (part of BCM2046 Bluetooth) ports: 3 rev: 2.0 speed: 12 Mb/s (1.4 MiB/s) lanes: 1 mode: 1.1 power: 94mA chip-ID: 0a5c:4500 class-ID: 0900 Device-1: 1-8.3:8 info: Apple Bluetooth Host Controller type: bluetooth driver: btusb interfaces: 4 rev: 2.0 speed: 12 Mb/s (1.4 MiB/s) lanes: 1 mode: 1.1 chip-ID: 05ac:828d class-ID: fe01 Hub-4: 2-0:1 info: super-speed hub ports: 6 rev: 3.0 speed: 5 Gb/s (596.0 MiB/s) lanes: 1 mode: 3.2 gen-1x1 chip-ID: 1d6b:0003 class-ID: 0900 Device-1: 2-1:2 info: Western Digital My Passport 264F type: mass storage driver: uas interfaces: 1 rev: 3.2 speed: 5 Gb/s (596.0 MiB/s) lanes: 1 mode: 3.2 gen-1x1 power: 896mA chip-ID: 1058:264f class-ID: 0806 serial: <filter> Sensors: System Temperatures: cpu: 49.0 C mobo: N/A gpu: nouveau temp: 45.0 C Fan Speeds (rpm): N/A Info: Processes: 265 Uptime: 1h 45m wakeups: 0 Init: systemd v: 254 default: graphical tool: systemctl Compilers: gcc: 13.2.1 clang: 16.0.6 Packages: 1168 pm: pacman pkgs: 1151 libs: 324 tools: pamac pm: flatpak pkgs: 17 Shell: Zsh v: 5.9 default: Bash v: 5.2.21 running-in: konsole inxi: 3.3.31
We (digiKam) set the libJpeg option “transformoption.perfect = true”. From a libJpeg version >= 8, this prevents a lossless rotation from being carried out on images where this is not possible, usually because the division factor of the side length is not 8. Also see Bug 320107. Check the digiKam Help-> Component Information to see which libJpeg version digiKam is using. If you use a version smaller than 8, you have to deactivate the lossless rotation in the digiKam setup. Maik
Git commit 2e117d2793c0fdda6cd4bcaab6f72ea60a7e8583 by Maik Qualmann. Committed on 31/12/2023 at 10:36. Pushed by mqualmann into branch 'master'. add simple check of the divisibility of the image size with libJpeg < 8 Just checking the image size does not provide 100% certainty as to whether Jpeg rotation can be carried out without loss. But it's better than nothing with libJpeg < 8. M +11 -0 core/libs/jpegutils/jpegutils.cpp https://invent.kde.org/graphics/digikam/-/commit/2e117d2793c0fdda6cd4bcaab6f72ea60a7e8583
(In reply to Maik Qualmann from comment #1) > If you use a version smaller than 8, you have to deactivate the lossless > rotation in the digiKam setup. That is the case, thank you for your help.