Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > More E-Book Readers > Bookeen

Notices

Reply
 
Thread Tools Search this Thread
Old 03-31-2009, 10:08 AM   #1
silvijakk
Junior Member
silvijakk began at the beginning.
 
Posts: 4
Karma: 10
Join Date: May 2008
Location: Latvia
Device: Cybook, Pocketbook 360
Adding cover image to PDF?

Is it possible? It's boring - to scroll rows of similar gray PDF covers. Maybe there is solution?
silvijakk is offline   Reply With Quote
Old 03-31-2009, 11:23 AM   #2
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Yes, look at this thread.

Though I'm afraid the link given there is not available anymore... Here are the files I use:

t2b.pl
Code:
#!/usr/bin/perl

use GD;

my $palette = $0;
$palette =~ s/[^\/]+$/palette.ppm/;

while ( my $file = shift @ARGV )
  {
  if ( $file =~ /\.pdf$/ )
    { open IN, "pdftops -f 1 -l 1 -paper match \"$file\" - | convert -resize 96x144 -map \"$palette\" -dither PNM:- | pnmtopng 2>/dev/null |"; }
  else
    { open IN, "convert -resize 96x144 -map \"$palette\" -dither \"$file\" PNM:- | pnmtopng 2>/dev/null |"; }
  my $in = join( '', <IN> );
  close IN;

  $image = GD::Image->new( $in );

  $k = 3;
  @px = ( );

  $left = int( ( 96 - $image->width ) / 2 );
  $right = 96 - $image->width - $left;
  $top = int( ( 144 - $image->height ) / 2 );
  $bottom = 144 - $image->height - $top;

  $file =~ s/\..+?$/_6090.t2b/;
  open OUT, "> $file";

  for ( $i = - $top; $i < 144 - $top; $i ++ )
    {
    for ( $j = - $left; $j < 96 - $left; $j ++ )
      {
      $px[$k --] = ( ( $i >= 0 and $i < $image->height and $j >= 0 and $j < $image->width ) ? $image->getPixel( $j, $i ) : 3 );
      if ( $k < 0 )
        {
        # this line can be here because 4 divides 96
        print OUT chr( $px[0] + 4 * $px[1] + 16 * $px[2] + 64 * $px[3] );
        $k = 3;
        }
      }

    }

  close OUT;
  }
palette.ppm
Code:
P3
2 2
255
0 0 0 85 85 85 170 170 170 255 255 255
Jellby is offline   Reply With Quote
Advert
Old 04-02-2009, 03:33 PM   #3
silvijakk
Junior Member
silvijakk began at the beginning.
 
Posts: 4
Karma: 10
Join Date: May 2008
Location: Latvia
Device: Cybook, Pocketbook 360
Thank you!
silvijakk is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding book series to cover??? artemisblossom Calibre 4 09-14-2010 05:31 PM
adding books cover comments icwright Calibre 5 12-22-2009 06:48 PM
Adding a new cover for LRF pikoman Calibre 0 11-06-2009 02:43 PM
Cover Image in PDF Metadata? ahi PDF 0 05-18-2009 06:56 PM
Adding a cover image to mobipocket files rheostaticsfan Kindle Formats 4 05-25-2008 03:40 PM


All times are GMT -4. The time now is 06:04 AM.


MobileRead.com is a privately owned, operated and funded community.