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

Fix printing of PBM files #2746

Closed
michaelrsweet opened this issue Mar 7, 2008 · 2 comments
Closed

Fix printing of PBM files #2746

michaelrsweet opened this issue Mar 7, 2008 · 2 comments
Milestone

Comments

@michaelrsweet
Copy link
Collaborator

Version: 1.3.6
CUPS.org User: martin.pitt.canonical

"lpr file.pbm" currently only produces garbage output for plain PBM (type "P1") files, and inverted output for normal PBM (type "P4") files.

Patch by Eugeniy Meshcheryakov. I tested it with the two attached example files.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Fixed in Subversion repository.

@michaelrsweet
Copy link
Collaborator Author

"str2746.patch":

Index: image-pnm.c

--- image-pnm.c (revision 7370)
+++ image-pnm.c (working copy)
@@ -178,6 +178,11 @@
switch (format)
{
case 1 :

  •      for (x = img->xsize, inptr = in; x > 0; x --, inptr ++)
    
  •        if (fscanf(fp, "%d", &val) == 1)
    
  •          *inptr = val ? 0 : 255;
    
  •      break;
    
    • case 2 :
      for (x = img->xsize, inptr = in; x > 0; x --, inptr ++)
      if (fscanf(fp, "%d", &val) == 1)
      @@ -203,9 +208,9 @@
      x --, inptr ++)
      {
      if (*outptr & bit)
  •          *inptr = 0;
    
  •        else
           *inptr = 255;
    
  •        else
    
  •          *inptr = 0;
    
         if (bit > 1)
           bit >>= 1;
    

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant