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

Auto crop not working on some pages #4106

Closed
onaka-itai opened this issue Jul 25, 2018 · 4 comments
Closed

Auto crop not working on some pages #4106

onaka-itai opened this issue Jul 25, 2018 · 4 comments
Labels
Milestone

Comments

@onaka-itai
Copy link

  • KOReader version: v2015.11-1735-g14e7730 (Latest release)
  • Device: Kobo Aura HD

Issue

Similar to #3376, using "fit to content width" sometimes does not work as it should. I checked the image(s) in Photoshop and it doesn't appear to have off-white pixels that would prevent accurate detection of the actual content.

I was wondering if there could be an option to set some sort of tolerance for cropping out white areas around the border with auto crop, rather than setting it to semi-auto and adjusting it every other page.

Using reflow removes a bit too much on lighter-inked pages, so I would rather not use that.

Steps to reproduce

Enable auto-cropping, and set zoom mode to "fit to content width."

Open the following files on Koreader:

This page gets cropped and fitted with no problems.
working_crop

This page does not:
nonworking_crop

I'm not sure what's causing it to work on the first page, but not the other. The second image does not have an off-white border running around it, just as it is on the first image.

@seacatwu
Copy link

Yes, I have this problem too.
:(

@Frenzie Frenzie added the bug label Jun 11, 2019
@hugleo
Copy link
Contributor

hugleo commented Dec 2, 2023

I believe the problem was introduced in #970 :

-- See discussion in koreader/koreader#970.
if ubbox_dimen.w <= page_size.w and ubbox_dimen.h <= page_size.h then
page_size = ubbox_dimen
self.view:onBBoxUpdate(ubbox_dimen)
else
self.view:onBBoxUpdate(nil)
end

It seems that the crop values are included in the ubbox_dimen var, and self.view:onBBoxUpdate(nil) with nil is being called.
I've changed for test to self.view:onBBoxUpdate(ubbox_dimen) and got the image cropped.

@Frenzie
Copy link
Member

Frenzie commented Dec 2, 2023

Isn't that describing the situation before that else was introduced to work around whatever the problem is there?

@hugleo
Copy link
Contributor

hugleo commented Dec 2, 2023

I didn't fix it, just test like reverting back :)

hugleo added a commit to hugleo/koreader that referenced this issue Dec 3, 2023
After some tests with the said document from koreader#970 it seems like that the visual defect occurs for only semi-auto and manual crop modes.

I've removed auto-crop from the rule so koreader#4106 can be fixed when using auto-crop.
@hugleo hugleo mentioned this issue Dec 3, 2023
@Frenzie Frenzie closed this as completed in f990937 Dec 4, 2023
@Frenzie Frenzie added this to the 2023.12 milestone Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants