Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Irfanview path bug #5

Closed
Tamk1s opened this issue Mar 9, 2020 · 2 comments
Closed

Irfanview path bug #5

Tamk1s opened this issue Mar 9, 2020 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@Tamk1s
Copy link
Owner

Tamk1s commented Mar 9, 2020

If the Irfanview path contains spaces in it, THPConv conversion will fail. Probably due to forgetting to enclose some cmd prompt commands in Thwimp with "double quotes".

Bug tested and verified on battle_cup_retro.thp conversion in Hover Pack in MKWii_Tracks repo

@Tamk1s Tamk1s added the bug Something isn't working label Mar 9, 2020
@Tamk1s Tamk1s mentioned this issue Mar 9, 2020
@Tamk1s Tamk1s self-assigned this Mar 9, 2020
@Tamk1s
Copy link
Owner Author

Tamk1s commented Apr 5, 2020

frame_001
bad_frame_001
error.txt

Paths seem to be fine; however, bug only occurs with a path with a space in it

Enclosed are copy of a badly created and good JPG, and error log when encoding the THP using the bad JPG images (created when Irfanview has a space in its path).

Doing a binary difference between the good and bad JPG files shows an $FFC2 word being used in the bad JPG file for the Start of Frame (SOF) JPG marker. This indicates progressive JPG. (See wikipedia article under Syntax and Structure table for SOF2 marker)

It appears THPConv cannot handle progressive JPG, which is the bug here.

@Tamk1s
Copy link
Owner Author

Tamk1s commented Apr 5, 2020

Bugfix to apply:

JPG Progessive option is not a standard Irfanview commandline switch nor an Advanced Batch option, but a JPG Plugin Option. Therefore, the only way to change it is by the i_view32.ini file located in %appdata%\Roaming\Irfanview when converting to jpg by cmdline. (See folder acquitision function)

This option looks like this in the INI file:

[JPEG]
Load Grayscale=0
ExifRotate=1
Save Quality=85
Save Progressive=1

Fix method:

  • Copy %appdata%\Roaming\Irfanview\i_view32.ini file to THP working directory
  • Load copied INI file in working dir
  • Find "[JPEG]" string header in file
  • Find "Save Progressive" string line in file
  • If found, cache current bit value; if not found, throw error
  • Replace value to "0"
  • Do normal JPG conversion, but using /ini=[THP_working_dir] folder

Tamk1s added a commit that referenced this issue Apr 6, 2020
*Fixed bug with THP Encoding failure when real Irfanview exe/path is pointed to
*Bug fixed by copying over Irfanview options INI file, overriding JPG Save Progress to 0 (false), and overriding JPG Quality setting, then using INI file for BMP->JPG conversion
*Bumped up copyright years to 2020 and version number to v1.2
@Tamk1s Tamk1s closed this as completed Apr 6, 2020
@Tamk1s Tamk1s mentioned this issue Apr 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant