Script - Remove History - v0.2

Moderator: Kathy_9

LeviFiction
Advisor
Posts: 6472
Joined: Thu Oct 02, 2008 1:07 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Alienware M17xR4
processor: Intel Core i7-3630QM CPU - 2_40GH
ram: 6 GB
Video Card: NVIDIA GeForce GTX 660M
sound_card: Sound Blaster Recon3Di
Hard_Drive_Capacity: 500GB
Corel programs: PSP: 8-2023
Location: USA

Script - Remove History - v0.2

Post by LeviFiction »

Updated: October 12 - 2021
Script Name: PSPImageHistoryRemover
Download Link: https://github.com/LeviFiction/PSPImageHistoryRemoval
Compatibility: PSP X9-2022
Requirements: Place in Scripts-Trusted Folder
Description:
This one is a bit more on the experimental side.

Currently PSP does not offer a convenient way to remove the edit history from you PSPImage files. This script will attempt to make a copy of your image and remove the edit history.

The reason it makes a copy is to avoid any potential damage or loss to the file structure if something doesn't work out quite like I had planned. But the three images I tried this on came out fully functional. So I am hopeful.

Updated to Version 0.2 - No longer removes EXIF and XMP data from the extended data block. Though might be a bit slow on really large images.
Last edited by LeviFiction on Wed Oct 13, 2021 1:34 am, edited 1 time in total.
Jean-Luc
Advisor
Posts: 1997
Joined: Sat Oct 22, 2011 10:50 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: ASUS Computer N751J
processor: Intel i7_4710 HQ 2_50GHz
ram: 16GB
Video Card: NVIDIA GeForce GTX 850M
sound_card: NVIDIA High Definition Audio
Hard_Drive_Capacity: 2 Tb
Monitor/Display Make & Model: NVIDIA GeForce GTX 850M
Corel programs: PSP X7, X9, 2018 to 2023
Location: Belgium (French speaking)

Re: Script - Remove History

Post by Jean-Luc »

Tested...
History is removed. OK.
Some EXIF infos are discarded in the duplicate file.
File size is increased (???).

I need more testing...
THE PAINTSHOP PRO COOKBOOK
Installed PSP Ultimate: X7, X9, 2018, 2019, 2020, 2021, 2022, 2023
LeviFiction
Advisor
Posts: 6472
Joined: Thu Oct 02, 2008 1:07 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Alienware M17xR4
processor: Intel Core i7-3630QM CPU - 2_40GH
ram: 6 GB
Video Card: NVIDIA GeForce GTX 660M
sound_card: Sound Blaster Recon3Di
Hard_Drive_Capacity: 500GB
Corel programs: PSP: 8-2023
Location: USA

Re: Script - Remove History

Post by LeviFiction »

Excellent! I, unfortunately, never tested EXIF because none of my test images had any EXIF information.

If you have any example images you'd be willing to post both the before and after history removal for extra testing I would appreciate it. Because the newest version of the file format documentation for PSPImage comes from all the way back in version 9, I'm kind of guessing my way around things. xD Thankfully they made a really good format that simply adds blocks in order to add new features. So it should be easy to find the unknown value and begin testing to find out what it is.
Jean-Luc
Advisor
Posts: 1997
Joined: Sat Oct 22, 2011 10:50 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: ASUS Computer N751J
processor: Intel i7_4710 HQ 2_50GHz
ram: 16GB
Video Card: NVIDIA GeForce GTX 850M
sound_card: NVIDIA High Definition Audio
Hard_Drive_Capacity: 2 Tb
Monitor/Display Make & Model: NVIDIA GeForce GTX 850M
Corel programs: PSP X7, X9, 2018 to 2023
Location: Belgium (French speaking)

Re: Script - Remove History

Post by Jean-Luc »

LeviFiction wrote: If you have any example images you'd be willing to post
I have tested with Corel samples image : fresh.jpg
It is made by an Apple iPhone.
Camera information is removed and also the size (Mo) after the script.
Didn't verify other data.
:)
THE PAINTSHOP PRO COOKBOOK
Installed PSP Ultimate: X7, X9, 2018, 2019, 2020, 2021, 2022, 2023
LeviFiction
Advisor
Posts: 6472
Joined: Thu Oct 02, 2008 1:07 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Alienware M17xR4
processor: Intel Core i7-3630QM CPU - 2_40GH
ram: 6 GB
Video Card: NVIDIA GeForce GTX 660M
sound_card: Sound Blaster Recon3Di
Hard_Drive_Capacity: 500GB
Corel programs: PSP: 8-2023
Location: USA

Re: Script - Remove History

Post by LeviFiction »

Interesting, so I tried several of the sample images. Thank you for that.

I made two very simple scripts, one that saved the EXIF information to a file, and one that read it back in and compared it to the current image. I then ran the save exif script, then removed the history, loaded in the NoHistory version, and ran the comparison script.

Alright, using Fresh here is the information that was lost.
ExifSoftware : 8.1.2
ExifDigitizedSubSecond : 977
ExifMake : Apple
ExifHeight : 2448
ExifModel :iPhone 5s
ExifWidth : 2448
Size on Disk went from 26MB to 8MB = 18MB smaller

HotAirBallons lost Information
ExifSoftware : QuickTime 7.6.9
ExifOriginalSubSecond : 0
ExifDigitizedSubSecond : 0
ExifMake : Canon
ExifHeight : 5184
ExifModel : Canon PowerShot SX610 HS
ExifWidth : 3888
ExifAltitudeRef : 0
ExifGPSStatus : A
Size on Disk went from 62MB to 44MB = 18MB smaller

Green lost information
ExifSoftware : 7.0.5
ExifDigitizedSubSecond : 150
ExifMake : Apple
ExifHeight : 2448
ExifModel : iPhone 5s
ExifWidth : 3264
Size on disk went from 35MB to 17MB = 18MB smaller

Heart lost information
ExifSoftware : 7.0
ExifDigitizedSubSecond : 16
ExifMake : Apple
ExifHeight : 1936
ExifModel : iPhone 4
ExifWidth : 2592
ExifAltitudeRef : 0
ExifGPSStatus : A
Size on disk went from 25MB to 8MB = 17MB smaller

So....now that I have that information. I wonder how the EXIF data is offset in PSP. Or if these particular EXIF data points are simply stored in the same info block as the history. I'll have to either make an EXIF reader for PSPImage format or just manually go through it in a hex editor to find out how it works.
LeviFiction
Advisor
Posts: 6472
Joined: Thu Oct 02, 2008 1:07 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Alienware M17xR4
processor: Intel Core i7-3630QM CPU - 2_40GH
ram: 6 GB
Video Card: NVIDIA GeForce GTX 660M
sound_card: Sound Blaster Recon3Di
Hard_Drive_Capacity: 500GB
Corel programs: PSP: 8-2023
Location: USA

Re: Script - Remove History

Post by LeviFiction »

Okay, so I had assumed the block where the history was found was purely a history block. Turns out it's an XML block. Which includes EXIF data. So that would explain the lost EXIF as I just throw out the xml block altogether. It's why the script is so fast as well, I just skip over the data we're getting rid of. In order to get rid of only the history and keep the exif data would be a slight bit slower. Not by much, but...if you ever see a 300+mb file that could be a bit slower. Especially as I wouldn't want to load it all in to memory just to separate the history from everything else. So I'd have to identify the beginning and ending tags then skip over those an re-define the size of the block. And the container block.
Jean-Luc
Advisor
Posts: 1997
Joined: Sat Oct 22, 2011 10:50 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: ASUS Computer N751J
processor: Intel i7_4710 HQ 2_50GHz
ram: 16GB
Video Card: NVIDIA GeForce GTX 850M
sound_card: NVIDIA High Definition Audio
Hard_Drive_Capacity: 2 Tb
Monitor/Display Make & Model: NVIDIA GeForce GTX 850M
Corel programs: PSP X7, X9, 2018 to 2023
Location: Belgium (French speaking)

Re: Script - Remove History

Post by Jean-Luc »

I understand ...
THE PAINTSHOP PRO COOKBOOK
Installed PSP Ultimate: X7, X9, 2018, 2019, 2020, 2021, 2022, 2023
SJS
Posts: 126
Joined: Thu May 26, 2011 1:31 am
operating_system: Windows 11
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Dell Inc 0KWVT8 A03
processor: 11th Gen Intel Core TM i7-11700
ram: 16 GB
Video Card: NVIDIA GeForce GTX 1660 Ti 6GB GDDR6
sound_card: Onboard Realtek Codec
Hard_Drive_Capacity: 4 TB
Monitor/Display Make & Model: DELL U2412M
Corel programs: PaintshopPro 2022 Ultimate
Location: Washington State, USA

Re: Script - Remove History - v0.2

Post by SJS »

Thank you for this script! My <4MB file grew to 115MB overnight and I had no idea why! PSP was incredibly slow, almost dysfunctional with that file, and I have given up on these absurdly large files previously without knowing the cause/cure.
The script took a few minutes to complete, but did the job. Now my mostly vector file is tiny and life is better.