View Single Post
Old 10-10-2010, 10:11 AM   #97
lilman
Addict
lilman has learned how to read e-bookslilman has learned how to read e-bookslilman has learned how to read e-bookslilman has learned how to read e-bookslilman has learned how to read e-bookslilman has learned how to read e-bookslilman has learned how to read e-bookslilman has learned how to read e-books
 
lilman's Avatar
 
Posts: 326
Karma: 960
Join Date: Jul 2009
Location: Florida, US
Device: Kindle DX, iPad
Quote:
Originally Posted by badbob001 View Post
I'm pretty sure it's cropping a page that has a black background (see attached).

Is there a way to make auto_rotate not rotate a page if it is undersized? See the attached before.jpg and after.jpg.
The original size is 700x500. I have my device resolution set to 800x-1 so it should fit without change. But...
  • It's black background got cropped.
  • It got rotated.
  • It got shrunken.
  • The left and right sides got filled with a white background.
I'm not sure what really happened and why it got downsized. Perhaps it got downsized and then rotated?

I have another page that is 1103x803. Ideally, it would be rotated and shrunked to something like 800x1100. But it got rotated and shrunked to 587x803 and had borders added to the sides to create a final 800x803 image. I disabled borders and the image is still shrunken. Again no difference if I change max_dpi between -1, 167, and 72.
I've suspected that ImageMagick ignores the color I tell it to trim. I will play around with it and see if I can force it better.

I'm also thinking about writing my own trim algorithm. I already have some pixel interpretation code from the auto split landscape scans feature, but I'm pretty sure it wouldn't be able to handle as many input image formats as ImageMagick. I can always program it and see how it goes.

Quote:
Originally Posted by badbob001 View Post
I really have no idea what is going on, but I see convert.exe using 8MB of ram and 2+GB of virtual memory. Now the harddrive is thrashing and it's very very slow, hence why I just left it running.

This a laptop has a Core 2 Due 2.26Ghz, 2GB ram and Windows XP. I'm going to increase the page file from 2GB to 3GB to see if that helps. How can I have canti skip the final PDF output step? What are the convert.exe parameters to create the final pdf from the processed images? I want to see if I can run convert.exe outside of canti but using the same parameters to see what happens.
To have Canti skip the final pdf output step, disable pdf output in the .properties file (pdf = false). Let's see, the ImageMagick command to create a pdf is something like:
Code:
convert *.jpg out.pdf
That should do it. Just open a command terminal within the image folder you want to make a pdf of and run that command (I'm assuming the image format is .jpg, if not change *.jpg to whatever format you are using).

Quote:
Originally Posted by badbob001 View Post
In other news, I've made a batch file that makes it possible to invoke canti by dragging a folder or comic file onto a script file, avoiding the need to open a command prompt.

Open notepad, paste the following, and save as something like run.cmd in the canti folder.

Code:
@echo off
set parent_folder=%~1
set title=%~n1
set app_folder=%~dp0
set output_folder=%~dp0%~n1\

set parent_folder=%parent_folder:\=\\%
set output_folder=%output_folder:\=\\%

echo - Parameters ----------------
echo app_folder=%app_folder%
echo parent_folder=%parent_folder%
echo title=%title%
echo output_folder=%output_folder%
echo.
echo - To Run ----------------
set to_run=java -jar canti.jar -parent_folder "%parent_folder%" -title "%title%" -output_folder "%output_folder%"
echo %to_run%
echo.
pause
cd "%app_folder%"
%to_run%
pause
Then simply drag and drop a folder or comic file (eg: cbz, zip) and the script will assume the title is the folder/file name and output is located where the script is but in a subfolder named after the title.
Nice, thanks for sharing. I know some people don't like command line programs. Hopefully I will make a proper gui... eventually.

-Edit-
I think I fixed both the ImageMagick trimming non-white space and weird output sizes when specifying one dimensional resize. I pm'ed you the code and if all is fixed I will post the update.

Last edited by lilman; 10-10-2010 at 06:46 PM.
lilman is offline   Reply With Quote