[sane-devel] Canon DR-C125: Wrong colors when scanning Duplex

m. allan noah kitno455 at gmail.com
Sun Mar 20 01:39:51 UTC 2016


Ok, after further digging, I think the margin and color problems are
related. I have attached a new patch, please give it a try instead.

allan

On Sat, Mar 19, 2016 at 5:51 AM, el-ti <tl at ewetel.net> wrote:
> Hello Allan,
>
> I’m afraid, the cdr-55b didn’t change anything – although I don’t understand this. I also double checked: first I followed your instructions, but thenI unpacked the backends.tar.gz again to apply cdr-55b on the fresh files, because I wanted to make sure, I did not make a mistake. But even then, the scans returned the same results. Is that even possible?
>
> See here: https://de.owncube.com/index.php/s/Dkqvp3O0hJEVPu7
>
> best regards,
> el-ti
>
> Am 18.03.2016 um 12:53 schrieb m. allan noah:
>> I have attached another patch. We will have to remove the first one,
>> and add this new one to the source code directory you made before:
>>
>> 1. Change into the source directory (update name as required)
>> cd sane-backends-gitXXXXXX/
>>
>> 2. Remove the old patch (update location as required, perhaps also ~/Downloads)
>> cat ~/Downloads/cdr-55a.diff | patch -p1 -R
>>
>> 3. Apply the new patch (update location as required, perhaps also ~/Downloads)
>> cat ~/Downloads/cdr-55b.diff | patch -p1
>>
>> 4. Rebuild, reinstall
>> make
>> sudo make install
>>
>> 5. Test again.
>>
>> allan
>>
>>
>> On Fri, Mar 18, 2016 at 6:04 AM, el-ti <tl at ewetel.net> wrote:
>> > Oh, I see!
>> >
>> > Now I did the scans again, each time power cycling the scanner:
>> >
>> > 1. Power on scanner.
>> > 2. Plug scanner in.
>> > 3. Start gscan2pdf.
>> > 4. Adjust settings and scan and save.
>> > 5. Quit gscan2pdf.
>> > 6. Plug out scanner.
>> > 7. Power off scanner.
>> >
>> > You can find the results here:
>> > https://de.owncube.com/index.php/s/wQuYx6dkz5D8Gau
>> >
>> > As far as I can see, nothing changed to the previous test. Hope this helps.
>> >
>> > el-ti
>> >
>> >
>> > Am 17.03.2016 um 12:20 schrieb m. allan noah:
>> >> Yes, the patch changed something, you can look at it and see what it
>> >> did, it is fairly small. The problem is that I don't think it should
>> >> have changed 240, so if you are seeing a behavior change there, we
>> >> need to do further investigation. So, I will be more explicit:
>> >>
>> >> Please make another set of scans, the same as you last did, but turn
>> >> the scanner off and back on between each scan. Presumably you will
>> >> have to stop and restart your scanning program too. I want to see if
>> >> the earlier scans somehow pollute the later ones.
>> >>
>> >> After that, I will walk you thru adjusting the code, and we will try again.
>> >>
>> >> allan
>> >>
>> >> On Thu, Mar 17, 2016 at 4:28 AM, el-ti <tl at ewetel.net> wrote:
>> >>> Hmmm, but the patch changed something, didn’t it? Without the patch 300dpi was wrong colors, now 300dpi is good. Unfortunately now 240dpi is wrong.
>> >>>
>> >>> If it’s too much work to get it running, It’s maybe okay, I normally do color scans with 300dpi. But I would probably consider getting rid of this model.
>> >>>
>> >>> If by power cycling you mean turning the scanner off and on, before using it (after installing the patched version) – yes, I always do that.
>> >>>
>> >>> best regards,
>> >>> el-ti
>> >>>
>> >>>
>> >>> Am 16.03.2016 um 22:11 schrieb m. allan noah:
>> >>>> My patch did not change anything about 240dpi, since you said that was
>> >>>> already working. I think perhaps there is something else going on
>> >>>> here. Can you power cycle the scanner after each test?
>> >>>>
>> >>>> allan
>> >>>>
>> >>>> On Wed, Mar 16, 2016 at 1:45 PM, el-ti <tl at ewetel.net> wrote:
>> >>>>> Oh! Mea culpa – I missed that point. But now the scanner works again,
>> >>>>> and the behavior changed!  – That’s the good news. Not so good news is,
>> >>>>> that now I have the following:
>> >>>>>
>> >>>>> Resolutions 300 and 600 have the right colors.
>> >>>>>
>> >>>>> Scanning with 100,150, 200 and 400 is now:
>> >>>>> Blue -> Green
>> >>>>> Green -> Red
>> >>>>> Red -> Blue
>> >>>>>
>> >>>>> Scanning with 240 is now:
>> >>>>> Blue -> Red
>> >>>>> Red -> Green
>> >>>>> Green -> Blue
>> >>>>>
>> >>>>> I don’t know if it helps, but I created a pdf document with scans in
>> >>>>> color mode of the same page with the different resolutions in ascending
>> >>>>> order: 100,150,200,240,300,400,600
>> >>>>>
>> >>>>> You can get it here:
>> >>>>> https://de.owncube.com/index.php/s/KaSuVc4vRFWdOk4
>> >>>>>
>> >>>>> What you can also see there, is that there is a color strip on the left
>> >>>>> side and that the page is a bit shifted horizontally – but this is not
>> >>>>> our discussed problem at the moment.
>> >>>>>
>> >>>>> I hope this helps you.
>> >>>>>
>> >>>>> Thanks!
>> >>>>> el-ti
>> >>>>>
>> >>>>> Am 16.03.2016 um 15:01 schrieb m. allan noah:
>> >>>>>> Did you install libusb-devel before you compiled sane-backends?
>> >>>>>>
>> >>>>>> allan
>> >>>>>>
>> >>>>>> On Wed, Mar 16, 2016 at 9:29 AM, el-ti <tl at ewetel.net> wrote:
>> >>>>>>> All right, I’m pretty sure I got everything right, but surprisingly the scanner is not detected anymore... ("scanimage -L" only gives back the internal notebook camera) – is it even possible, that this is caused by the steps above? Or did I do something wrong?
>> >>>>>>>
>> >>>>>>> Sorry for all the work…
>> >>>>>>>
>> >>>>>>>
>> >>>>>>> Am 16.03.2016 um 13:24 schrieb m. allan noah:
>> >>>>>>>> 1. Download sane-backends-git snapshot from:
>> >>>>>>>> http://www.sane-project.org/snapshots/
>> >>>>>>>>
>> >>>>>>>> 2. In a terminal, cd to the directory where you downloaded the file
>> >>>>>>>> (perhaps ~/Downloads)
>> >>>>>>>> cd ~/Downloads
>> >>>>>>>>
>> >>>>>>>> 3. Extract the file (update name as required)
>> >>>>>>>> tar xzf sane-backends-gitXXXXXXXX.tar.gz
>> >>>>>>>>
>> >>>>>>>> 4. Change into the source directory (update name as required)
>> >>>>>>>> cd sane-backends-gitXXXXXX/
>> >>>>>>>>
>> >>>>>>>> 5. Apply the patch (update location as required, perhaps also ~/Downloads)
>> >>>>>>>> cat ~/Downloads/cdr-55a.diff | patch -p1
>> >>>>>>>>
>> >>>>>>>> 6. Then you need to follow the instructions at
>> >>>>>>>> http://www.sane-project.org/README.linux That will have you installing
>> >>>>>>>> an updated version of sane-backends in /usr/local, where it has a
>> >>>>>>>> reduced change of causing problems for your system.
>> >>>>>>>>
>> >>>>>>>> Let me know if you have questions.
>> >>>>>>>>
>> >>>>>>>> allan
>> >>>>>>>>
>> >>>>>>>> On Wed, Mar 16, 2016 at 6:38 AM, el-ti <tl at ewetel.net> wrote:
>> >>>>>>>>> Thank you very much for your work.
>> >>>>>>>>>
>> >>>>>>>>> Unfortunately, I have no experience with patching something like this so far. I did some research, though – seems to be quite doable. I’m familiar with the terminal etc. As I understand this, I have to apply the diff-file on the original file with the patch command. So far, so good – but I have no idea, which file it is. I couldn’t figure out by looking at the diff file.
>> >>>>>>>>>
>> >>>>>>>>> If you could tell, on which file I have to apply this, that would be great! Thanks!
>> >>>>>>>>>
>> >>>>>>>>> Tobias
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>> Am 16.03.2016 um 01:33 schrieb m. allan noah:
>> >>>>>>>>>> I have attached a patch for the sane-backends source code. This
>> >>>>>>>>>> attempts to provide alternate color de-interlacing for your scanner.
>> >>>>>>>>>> It does not attempt to fix any edge cropping issues. Let me know if
>> >>>>>>>>>> you need more instructions.
>> >>>>>>>>>>
>> >>>>>>>>>> allan
>> >>>>>>>>>>
>> >>>>>>>>>> On Tue, Mar 15, 2016 at 7:59 PM, m. allan noah <kitno455 at gmail.com> wrote:
>> >>>>>>>>>>> Canon scanners often have this variable interlacing at different
>> >>>>>>>>>>> resolutions, so I am not surprised to see this. However, this
>> >>>>>>>>>>> particular scanner has the weirdest interlacing that canon does. If
>> >>>>>>>>>>> you can compile from source, I can send you some patches to try. See
>> >>>>>>>>>>> http://www.sane-project.org/README.linux
>> >>>>>>>>>>>
>> >>>>>>>>>>> allan
>> >>>>>>>>>>>
>> >>>>>>>>>>> On Tue, Mar 15, 2016 at 9:17 AM, el-ti <tl at ewetel.net> wrote:
>> >>>>>>>>>>>> Unfortunately, yes.
>> >>>>>>>>>>>>
>> >>>>>>>>>>>> I uninstalled "cndrvsane-drc125" and restartet the system. The color shift is still there.
>> >>>>>>>>>>>>
>> >>>>>>>>>>>> And there is also the problem, that there is a 1/2 cm cut on the long edge of the scanned page (the "duplex-offset" option only handles the short edge) – but I guess this is another problem.
>> >>>>>>>>>>>>
>> >>>>>>>>>>>> If you need more information, do not hesitate to tell me.
>> >>>>>>>>>>>>
>> >>>>>>>>>>>> el-ti
>> >>>>>>>>>>>>
>> >>>>>>>>>>>> Am 15.03.2016 um 12:41 schrieb m. allan noah:
>> >>>>>>>>>>>>> If you uninstall the Canon "DR-C125 Driver for Linux V1.0 (v1.0)"
>> >>>>>>>>>>>>> software, does this color shift still happen?
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>> allan
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>> On Tue, Mar 15, 2016 at 7:37 AM, el-ti <tl at ewetel.net> wrote:
>> >>>>>>>>>>>>>> The system is using the libsane version from the PPA: 1.0.26-git20160305-wily0
>> >>>>>>>>>>>>>>
>> >>>>>>>>>>>>>> It was installed above the one from Ubuntu’s repositories, when I added the PPA.
>> >>>>>>>>>>>>>>
>> >>>>>>>>>>>>>> el-ti
>> >>>>>>>>>>>>>>
>> >>>>>>>>>>>>>> Am 15.03.2016 um 12:22 schrieb m. allan noah:
>> >>>>>>>>>>>>>>> You have installed both sane-backends, and canon's driver? Which one
>> >>>>>>>>>>>>>>> are you using? Assuming you are actually using sane-backends, we will
>> >>>>>>>>>>>>>>> have to modify the code to control the color descrambling.
>> >>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>> allan
>> >>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>> On Tue, Mar 15, 2016 at 6:08 AM, el-ti <tl at ewetel.net> wrote:
>> >>>>>>>>>>>>>>>> Hello,
>> >>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>> I have an appendix to make – maybe someone has a hint for me, why the
>> >>>>>>>>>>>>>>>> scanner behaves really strange:
>> >>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>> Depending on the scanning resolution, the shifting on the color range is
>> >>>>>>>>>>>>>>>> different! I used the following command to test this:
>> >>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>> scanimage --batch --source "ADF Duplex" --page-width 210
>> >>>>>>>>>>>>>>>> --page-height=297 -l 0 -t 0 -x 210 -y 297 --mode Color --resolution 300
>> >>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>> Then I tried all available resolutions: 100, 150, 200, 240, 300, 400,
>> >>>>>>>>>>>>>>>> 600. The results are strange:
>> >>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>> Scanning with 100,150,200 gives me:
>> >>>>>>>>>>>>>>>> Blue -> Red
>> >>>>>>>>>>>>>>>> Red -> Green
>> >>>>>>>>>>>>>>>> Green -> Blue
>> >>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>> Scanning with 300 and 400 gives me:
>> >>>>>>>>>>>>>>>> Blue -> Green
>> >>>>>>>>>>>>>>>> Green -> Red
>> >>>>>>>>>>>>>>>> Red -> Blue
>> >>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>> And scanning with 240 and 600 shows the RIGHT colors.
>> >>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>> How is that possible? And how can this problem be solved?
>> >>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>> I installed Rolf Bensch’s PPA
>> >>>>>>>>>>>>>>>> (https://launchpad.net/~rolfbensch/+archive/ubuntu/sane-git), because it
>> >>>>>>>>>>>>>>>> solved the back page cutting problem when scanning Duplex. (see
>> >>>>>>>>>>>>>>>> http://permalink.gmane.org/gmane.comp.graphics.scanning.sane.devel/24903)
>> >>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>> Other than that, I only installed the Canon "DR-C125 Driver for Linux
>> >>>>>>>>>>>>>>>> V1.0 (v1.0)".
>> >>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>> Any hint is appreciated!
>> >>>>>>>>>>>>>>>> el-ti
>> >>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>> Am 04.03.2016 um 10:59 schrieb el-ti:
>> >>>>>>>>>>>>>>>>> Dear Sane-developers and users,
>> >>>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>>> through this very helpful discussion
>> >>>>>>>>>>>>>>>>> (http://permalink.gmane.org/gmane.comp.graphics.scanning.sane.devel/24903),
>> >>>>>>>>>>>>>>>>> I managed to get my Canon Scanner working in Duplex without cutting 1 cm
>> >>>>>>>>>>>>>>>>> of the back page.
>> >>>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>>> Everything seems to work fine. However, I discovered a very strange
>> >>>>>>>>>>>>>>>>> behaviour regarding the colour management: When scanning in simplex
>> >>>>>>>>>>>>>>>>> mode, everything works fine. There is no page cutting and colours are as
>> >>>>>>>>>>>>>>>>> they should be. But in duplex mode, the colours are somehow shifted on
>> >>>>>>>>>>>>>>>>> the colour range: Blue is scanned as green, green is scanned as red, red
>> >>>>>>>>>>>>>>>>> is scanned as blue (for both back and front page).
>> >>>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>>> Is there an easy solution for this? Or did I forget to install something?
>> >>>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>>> Thank you very much!
>> >>>>>>>>>>>>>>>>> el-ti
>> >>>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>> --
>> >>>>>>>>>>>>>>>> sane-devel mailing list: sane-devel at lists.alioth.debian.org
>> >>>>>>>>>>>>>>>> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
>> >>>>>>>>>>>>>>>> Unsubscribe: Send mail with subject "unsubscribe your_password"
>> >>>>>>>>>>>>>>>>              to sane-devel-request at lists.alioth.debian.org
>> >>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>
>> >>>>>>>>>>>
>> >>>>>>>>>>>
>> >>>>>>>>>>>
>> >>>>>>>>>>> --
>> >>>>>>>>>>> "well, I stand up next to a mountain- and I chop it down with the edge
>> >>>>>>>>>>> of my hand"
>> >>>>>>>>>>
>> >>>>>>>>>>
>> >>>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>
>> >>>>>>
>> >>>>>>
>> >>>>>>
>> >>>>
>> >>>>
>> >>>>
>> >>>
>> >>
>> >>
>> >>
>> >
>>
>>
>>
>



-- 
"well, I stand up next to a mountain- and I chop it down with the edge
of my hand"
-------------- next part --------------
diff --git a/backend/canon_dr.c b/backend/canon_dr.c
index da0a6a9..6b21289 100644
--- a/backend/canon_dr.c
+++ b/backend/canon_dr.c
@@ -329,6 +329,8 @@
          - use bg_color to fill missing image data
       v54 2015-11-21, MAN
          - br_x and br_y locked to page_width/height until changed
+      v55 2016-03-19, MAN
+         - fixed-width scanners were calculating left-side offset incorrectly in color
 
    SANE FLOW DIAGRAM
 
@@ -379,7 +381,7 @@
 #include "canon_dr.h"
 
 #define DEBUG 1
-#define BUILD 54
+#define BUILD 55
 
 /* values for SANE_DEBUG_CANON_DR env var:
  - errors           5
@@ -5395,7 +5397,7 @@ copy_line(struct scanner *s, unsigned char * buff, int side)
   switch (s->i.mode) {
   
     case MODE_COLOR:
-      memcpy(s->buffers[side]+s->i.bytes_sent[side], line+offset, ibwidth);
+      memcpy(s->buffers[side]+s->i.bytes_sent[side], line+(offset*3), ibwidth);
       s->i.bytes_sent[side] += ibwidth;
       break;
   


More information about the sane-devel mailing list