To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cadOpen lugnet.cad in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / 13017
     
   
Subject: 
img2sticker: Convert images into .ldr stickers
Newsgroups: 
lugnet.cad, lugnet.trains
Followup-To: 
lugnet.cad
Date: 
Wed, 29 Jun 2005 16:51:15 GMT
Viewed: 
3323 times
  

Dear all,

Following up from my teaser the other day, I’ve ‘completed’ my software to convert image files into ldraw files for use in sticker making and written a little tutorial about getting it to work.



Here is where you can download/understand/etc. the software and after that you can look at the tutorial.

I apologise to all that this version is really for the computer savvy as the whole thing is written in perl which requires either linux/unix/OSX or Windows with perl installed (linked to on the download page).

Please let me know if you use this program/enjoy it/hate a certain feature etc. If people like it (or want a version they can get working on their computer) I plan on releasing a C version when I can find the energy to rewrite.

Hope this proves useful,

Tim

PS. The code is GPL’d so if anyone wants to mess with it, please do!

   
         
     
Subject: 
Re: img2sticker: Convert images into .ldr stickers
Newsgroups: 
lugnet.cad
Date: 
Wed, 29 Jun 2005 21:36:26 GMT
Viewed: 
1763 times
  

In lugnet.cad, Timothy Gould wrote:
   Dear all,

Following up from my teaser the other day, I’ve ‘completed’ my software to convert image files into ldraw files for use in sticker making and written a little tutorial about getting it to work.



Here is where you can download/understand/etc. the software and after that you can look at the tutorial.

I apologise to all that this version is really for the computer savvy as the whole thing is written in perl which requires either linux/unix/OSX or Windows with perl installed (linked to on the download page).

Please let me know if you use this program/enjoy it/hate a certain feature etc. If people like it (or want a version they can get working on their computer) I plan on releasing a C version when I can find the energy to rewrite.

Hope this proves useful,

Tim

PS. The code is GPL’d so if anyone wants to mess with it, please do!

Looks interesting, I’m going to give it a go, might be a steep learning curve tho!

cheers Tim

    
          
     
Subject: 
Re: img2sticker: Convert images into .ldr stickers
Newsgroups: 
lugnet.cad
Date: 
Thu, 30 Jun 2005 18:50:35 GMT
Viewed: 
1707 times
  

Right, suffered my first set-back :( I’ve downloaded and installed Perl OK (I’m using Windows XP) I downloaded and unzipped img2sticker to a folder called D:Img2Sticker but then I can’t work out how to install it My Ldraw directory is D:Program FilesLDraw, from your instructions I am assuming you recommend installing it in the location of the ldraw files? I added an environment variable of:-
LDRAWDIR=D:\Program Files\Ldraw
and rebooted. However running the command:-
D:\Img2Sticker\install.pl [LDRAWDIR]
gives the error:-
img2sticker installer
The system cannot find the file specified.
Please add [LDRAWDIR] to your PATH environment variable
Please copy the tutorial directory to a location of your choice
I’m not certain from this which path it is that it can’t find and also why it thinks there isn’t an LDRAWDIR path.

Any ideas?


Tim

    
          
     
Subject: 
Re: img2sticker: Convert images into .ldr stickers
Newsgroups: 
lugnet.cad
Date: 
Thu, 30 Jun 2005 20:23:19 GMT
Viewed: 
1714 times
  

In lugnet.cad, Tim David wrote:
Right, suffered my first set-back :(
I've downloaded and installed Perl OK (I'm using Windows XP)
I downloaded and unzipped img2sticker to a folder called D:\Img2Sticker but
then I can't work out how to install it My Ldraw directory is D:\Program
Files\LDraw, from your instructions I am assuming you recommend installing it
in the location of the ldraw files? I added an environment variable of:-

| LDRAWDIR=D:\Program Files\Ldraw

and rebooted.
However running the command:-

| D:\Img2Sticker\install.pl [LDRAWDIR]

gives the error:-

| img2sticker installer
| The system cannot find the file specified.
| Please add [LDRAWDIR] to your PATH environment variable
| Please copy the tutorial directory to a location of your choice

I'm not certain from this which path it is that it can't find and also why it
thinks there isn't an LDRAWDIR path.

Any ideas?


Tim

OK. I'm not 100% sure where that error comes from... could you run
'install.pl [LDRAWDIR] 2>err' and email me the err file that comes out. The last
two lines indicate success (which they should do more obviously) while the
others seem to be a system error which should have been caught. Strange.

To get it up and running quickly just copy everything to the directory and make
a batch file img2sticker.bat which looks like

perl -I[I2SDIR] [I2SDIR]\img2sticker.pl %*

where [I2SDIR] is the directory you've installed everything in. NB. This .bat
file can go anywhere really and so long as it is seen by the PATH variable it
*should*run.

That is really the whole point of the installer so I might just leave out
install.pl and give that instruction instead. Seems to be easier.

I'm currently working on a new version in C which should be much easier.

Tim

   
         
     
Subject: 
Re: img2sticker: Convert images into .ldr stickers
Newsgroups: 
lugnet.cad
Date: 
Wed, 29 Jun 2005 22:09:55 GMT
Viewed: 
1768 times
  

In lugnet.cad, Timothy Gould wrote:
   Here is where you can download/understand/etc. the software and after that you can look at the tutorial.

I have a comment on the tutorial. It’s probably easier to let your image editing program get rid of the antialiasing. If you’re using Photoshop or Photoshop Elements, all you have to do is change the image mode to indexed color, then select a small number of colors (2 in your sample image), and most of the work will be done for you. There’s relatively little cleanup required after that. As long as you have a fairly high-contrast image, you can probably do the same thing with images with more colors.

I imagine other full-featured image editing programs have the same functionality. (You won’t find it in Paint, of course.)

--Travis

    
          
      
Subject: 
Re: img2sticker: Convert images into .ldr stickers
Newsgroups: 
lugnet.cad
Date: 
Wed, 29 Jun 2005 22:56:07 GMT
Viewed: 
1746 times
  

In lugnet.cad, Travis Cobbs wrote:
   In lugnet.cad, Timothy Gould wrote:
   Here is where you can download/understand/etc. the software and after that you can look at the tutorial.

I have a comment on the tutorial. It’s probably easier to let your image editing program get rid of the antialiasing. If you’re using Photoshop or Photoshop Elements, all you have to do is change the image mode to indexed color, then select a small number of colors (2 in your sample image), and most of the work will be done for you. There’s relatively little cleanup required after that. As long as you have a fairly high-contrast image, you can probably do the same thing with images with more colors.

I imagine other full-featured image editing programs have the same functionality. (You won’t find it in Paint, of course.)

--Travis

Wow! Such a simple and practical solution. Added to the start of the tutorial.

Tim

    
          
     
Subject: 
Re: img2sticker: Convert images into .ldr stickers
Newsgroups: 
lugnet.cad
Date: 
Wed, 29 Jun 2005 23:02:38 GMT
Viewed: 
1997 times
  

In lugnet.cad, Travis Cobbs wrote:
   In lugnet.cad, Timothy Gould wrote:
   Here is where you can download/understand/etc. the software and after that you can look at the tutorial.

I have a comment on the tutorial. It’s probably easier to let your image editing program get rid of the antialiasing. If you’re using Photoshop or Photoshop Elements, all you have to do is change the image mode to indexed color, then select a small number of colors (2 in your sample image), and most of the work will be done for you. There’s relatively little cleanup required after that. As long as you have a fairly high-contrast image, you can probably do the same thing with images with more colors.

I imagine other full-featured image editing programs have the same functionality. (You won’t find it in Paint, of course.)

Also, Bob Kojima’s Bricksaic provides a very easy way to convert images to the LDraw colour palette.

ROSCO

    
          
     
Subject: 
Re: img2sticker: Convert images into .ldr stickers
Newsgroups: 
lugnet.cad
Date: 
Wed, 29 Jun 2005 23:26:40 GMT
Viewed: 
2126 times
  

   Also, Bob Kojima’s Bricksaic provides a very easy way to convert images to the LDraw colour palette.

ROSCO

I suspect that using this would be risky. My program actually implements a find-nearest colours routine but when dealing with aliased images, often the aliasing will come out to be grey, dark grey or even weirder colours (I match in HSV space which is perhaps dangerous here). That said if you restrict yourself to avoiding greys it should be OK.

Its just a pity that with 24bit colour everywhere, aliasing is used on everything (and of course it is hard to reverse). I remember in the good old days of 256 colour images where aliasing was only for the very, very best pictures.

Tim

    
          
     
Subject: 
Re: img2sticker: Convert images into .ldr stickers
Newsgroups: 
lugnet.cad
Date: 
Thu, 30 Jun 2005 00:16:45 GMT
Viewed: 
2249 times
  

In lugnet.cad, Timothy Gould wrote:
   Its just a pity that with 24bit colour everywhere, aliasing is used on everything (and of course it is hard to reverse). I remember in the good old days of 256 colour images where aliasing was only for the very, very best pictures.

Just as a note, it’s actually antialiasing, not aliasing. Aliasing (aka jaggies) is the problem that antialiasing solves. And you’re right; it’s very difficult to undo normally. On the other hand, for images that stickers are likely to be made for, down-sampling to very few colors will mostly get rid of the problem, and the pixels can be cleaned up by hand after that.

--Travis

    
          
     
Subject: 
Re: img2sticker: Convert images into .ldr stickers
Newsgroups: 
lugnet.cad
Date: 
Thu, 30 Jun 2005 09:35:26 GMT
Viewed: 
2377 times
  

In lugnet.cad, Travis Cobbs wrote:
   In lugnet.cad, Timothy Gould wrote:
   Its just a pity that with 24bit colour everywhere, aliasing is used on everything (and of course it is hard to reverse). I remember in the good old days of 256 colour images where aliasing was only for the very, very best pictures.

Just as a note, it’s actually antialiasing, not aliasing. Aliasing (aka jaggies) is the problem that antialiasing solves. And you’re right; it’s very difficult to undo normally. On the other hand, for images that stickers are likely to be made for, down-sampling to very few colors will mostly get rid of the problem, and the pixels can be cleaned up by hand after that.

--Travis

I did know that ;-) (and checked through all documents to make sure I had it right). I blame it on posting too long after I’d turned into a pumpkin.

The thing is, anti-aliasing should be invertible if you know the routine used to perform it in the first place. Of course it could be very slow as you have to invert a #pixels x #pixels matrix (althought it would be sparse). Maybe someone could write a GIMP or Photoshop plugin for it.

Tim

    
          
     
Subject: 
Re: img2sticker: Convert images into .ldr stickers
Newsgroups: 
lugnet.cad
Date: 
Thu, 30 Jun 2005 13:03:34 GMT
Viewed: 
2454 times
  

In lugnet.cad, Timothy Gould wrote:
   The thing is, anti-aliasing should be invertible if you know the routine used to perform it in the first place.

Hmm, I don’t think so. Traditional antialiasing spreads the partial pixel errors from a line (or edge) into the adjacent pixels. In order to undo it you’d need to know where the line is, but that’s the very information you’re trying to recover from the image.

In this case you’re not working from an antialiased image, but rather one that has been sampled by a scanner or a digital camera. There was no antialiasing applied. They just save what they see, blended colors and all.

   Maybe someone could write a GIMP or Photoshop plugin for it.

I’m pretty certain they already have edge sharpening and unblur convolution filters which should be useful for undoing some of the blending, before converting to the closest ldraw colors.

Have fun,

Don

    
          
     
Subject: 
Re: img2sticker: Convert images into .ldr stickers
Newsgroups: 
lugnet.cad
Date: 
Thu, 30 Jun 2005 14:54:21 GMT
Viewed: 
2638 times
  

   Hmm, I don’t think so. Traditional antialiasing spreads the partial pixel errors from a line (or edge) into the adjacent pixels. In order to undo it you’d need to know where the line is, but that’s the very information you’re trying to recover from the image.

Strictly speaking though, (almost) any filter is invertible. Of course you do need to know what the original filter was which is easier said than done.

   In this case you’re not working from an antialiased image, but rather one that has been sampled by a scanner or a digital camera. There was no antialiasing applied. They just save what they see, blended colors and all.

Although it even worse as the image has been stored a a jpeg which bleeds the colours even more in its compression algorithm.

   I’m pretty certain they already have edge sharpening and unblur convolution filters which should be useful for undoing some of the blending, before converting to the closest ldraw colors.

Yes but edge sharpening actually seems to make the antialiasing worse. If it finds an ‘edge’ between the ‘real’ colour and its fake neighbour it tries to exaggerate this. I suspect it has something to do with the frequency offsets in Fourier space.

   Have fun,

Don

Will do,

Tim

    
          
      
Subject: 
Re: img2sticker: Convert images into .ldr stickers
Newsgroups: 
lugnet.cad
Date: 
Thu, 30 Jun 2005 15:34:30 GMT
Viewed: 
2544 times
  

In lugnet.cad, Timothy Gould wrote:
  
   Hmm, I don’t think so. Traditional antialiasing spreads the partial pixel errors from a line (or edge) into the adjacent pixels. In order to undo it you’d need to know where the line is, but that’s the very information you’re trying to recover from the image.

Strictly speaking though, (almost) any filter is invertible. Of course you do need to know what the original filter was which is easier said than done.

Yeah, but if you think of line antialiasing as a sort of blur filter, you’ll notice the convolution kernel is directional. The blurring occurs perpendicular to the direction of the line. This implies a different filter for each line segment on an edge. Knowing the direction of ALL the filters is the same as knowing where the lines are.

    
          
     
Subject: 
Re: img2sticker: Convert images into .ldr stickers
Newsgroups: 
lugnet.cad
Date: 
Thu, 30 Jun 2005 17:07:41 GMT
Viewed: 
2584 times
  

In lugnet.cad, Timothy Gould wrote:
  
   Hmm, I don’t think so. Traditional antialiasing spreads the partial pixel errors from a line (or edge) into the adjacent pixels. In order to undo it you’d need to know where the line is, but that’s the very information you’re trying to recover from the image.

Strictly speaking though, (almost) any filter is invertible. Of course you do need to know what the original filter was which is easier said than done.

That may be true, but antialiasing isn’t a filter in that sense. When applied to computer-generated graphics, it’s calculated during rendering using information that isn’t available in the final image. When aplied during image scaling (shrinking), it makes use of the image information in the original (higher-resolution) image. The antialiasing you see in digital camera images is a combination of a physical antialiasing filter placed in front of the camera sensor (often integrated into the camera’s IR filter, apparently) and smoothing algorithms. So even if you knew which form of antialiasing was used on a particular image, I don’t think you could create a filter to undo it.

--Travis

   
         
     
Subject: 
Re: img2sticker: Convert images into .ldr stickers
Newsgroups: 
lugnet.cad
Date: 
Mon, 1 Aug 2005 14:06:48 GMT
Reply-To: 
CJMASI@*NOGARBAGEPLEASE*saynotospamRCN.COM
Viewed: 
1926 times
  

Tim Gould wrote:
Dear all,

Following up from my <http://news.lugnet.com/cad/?n=12993 teaser> the other day,
I've 'completed' my software to convert image files into ldraw files for use in
sticker making {and} written a little tutorial about getting it to work.

<<http://www.brickshelf.com/gallery/timgould/temp/sticker1.png>>

<http://www.lancs.ac.uk/staff/gouldt/img2sticker/img2sticker.html Here> is where
you can download/understand/etc. the software and after that you can look at the
<http://www.lancs.ac.uk/staff/gouldt/img2sticker/tutorial.html tutorial>.

I apologise to all that this version is really for the computer savvy as the
whole thing is written in perl which requires either linux/unix/OSX or Windows
with perl installed (linked to on the download page).

Please let me know if you use this program/enjoy it/hate a certain feature etc.
If people like it (or want a version they can get working on their computer) I
plan on releasing a C version when I can find the energy to rewrite.

Hope this proves useful,

Tim

PS. The code is GPL'd so if anyone wants to mess with it, please do!

Tim,

   I cannot get this installed. I am running Mac OS X 10.3.9, and every
time I run the script,

perl install.pl img2

it creates a directory but then says "Could not copy file at install.pl
line 42." Line 42 (or the 42nd line that I came to when I loaded the
script into pico) is
     `copy img2sticker.bat $d\n` || die "Could not copy file";
img2sticker.bat is definitely in the same directory as the install
script and the destination directory.
   When I try to intall into /Users/'username'/img2 I get
sh: line 1: copy: command not found
Could not copy file at install.pl line 42.


Sorry, I am a bit of a noob when it comes to this stuff, so I don't know
if its me or if Mac OS X is behaving unexpectedly.

Chris

    
          
     
Subject: 
Re: img2sticker: Convert images into .ldr stickers
Newsgroups: 
lugnet.cad
Date: 
Mon, 1 Aug 2005 18:54:26 GMT
Viewed: 
2050 times
  

On 8/1/05, Christopher Masi <cjmasi@*nogarbageplease*rcn.com> wrote:
   I cannot get this installed. I am running Mac OS X 10.3.9, and every
time I run the script,

perl install.pl img2

it creates a directory but then says "Could not copy file at install.pl
line 42." Line 42 (or the 42nd line that I came to when I loaded the
script into pico) is
     `copy img2sticker.bat $d\n` || die "Could not copy file";
img2sticker.bat is definitely in the same directory as the install
script and the destination directory.
   When I try to intall into /Users/'username'/img2 I get
        sh: line 1: copy: command not found
        Could not copy file at install.pl line 42.


Sorry, I am a bit of a noob when it comes to this stuff, so I don't know
if its me or if Mac OS X is behaving unexpectedly.

Chris

I suspect you will find on OS X, or Linux that you would need to
modify copy for cp. It is probably better to use perls own interface
to copying, and not the shell.

The perl docs for this are all here: http://perldoc.perl.org/File/Copy.html.

Cheers
Orion
--
http://orionrobots.co.uk - Build Robots

Online Castle Building RPG -
http://www.darkthrone.com/recruit.dt?uid=V30311I30328J30379X30379E30260X30277

    
          
     
Subject: 
Re: img2sticker: Convert images into .ldr stickers
Newsgroups: 
lugnet.cad
Date: 
Mon, 1 Aug 2005 19:46:06 GMT
Viewed: 
2036 times
  

I suspect you will find on OS X, or Linux that you would need to
modify copy for cp. It is probably better to use perls own interface
to copying, and not the shell.

The perl docs for this are all here: http://perldoc.perl.org/File/Copy.html.

Cheers
Orion

Hi Orion,

Thanks for that. Now I should be able to make the install program more platform
independent (it was set to run on Linux or Windows but I forgot about OSX).
Excellent!

Tim

   
         
   
Subject: 
Re: img2sticker: Convert images into .ldr stickers
Newsgroups: 
lugnet.cad
Date: 
Fri, 7 Oct 2005 03:43:44 GMT
Viewed: 
1941 times
  

In lugnet.cad, Timothy Gould wrote:
   Dear all,

Following up from my teaser the other day, I’ve ‘completed’ my software to convert image files into ldraw files for use in sticker making and written a little tutorial about getting it to work.



Here is where you can download/understand/etc. the software and after that you can look at the tutorial.

I apologise to all that this version is really for the computer savvy as the whole thing is written in perl which requires either linux/unix/OSX or Windows with perl installed (linked to on the download page).

Please let me know if you use this program/enjoy it/hate a certain feature etc. If people like it (or want a version they can get working on their computer) I plan on releasing a C version when I can find the energy to rewrite.

Hope this proves useful,

Tim

PS. The code is GPL’d so if anyone wants to mess with it, please do!

I’ve made a few attempts to use this, but I’m not having much luck. I’ve installed Perl, and I think I’m using the command line correctly. I keep getting the following though:

“You do not have LDRAWDIR defined. This must be defined in order to run img2sticker”

Any ideas on what I might be doing wrong? I’m attempting to run this from the command line of a Windows XP machine.

-Elroy

   
         
   
Subject: 
Re: img2sticker: Convert images into .ldr stickers
Newsgroups: 
lugnet.cad
Date: 
Fri, 7 Oct 2005 05:44:13 GMT
Viewed: 
2146 times
  

In lugnet.cad, Elroy Davis wrote:
  
I’ve made a few attempts to use this, but I’m not having much luck. I’ve installed Perl, and I think I’m using the command line correctly. I keep getting the following though:

“You do not have LDRAWDIR defined. This must be defined in order to run img2sticker”

Any ideas on what I might be doing wrong? I’m attempting to run this from the command line of a Windows XP machine.

LDRAWDIR is an environment variable which must be set to run the program. I assume img2sticker.pl uses the colours defined in ldconfig.ldr in that directory. To set it in XP:
  1. In Control Panel, choose “System”
  2. On the Advanced tab, click “Environment Variables”
  3. Click “New” and in the dialog box enter “LDRAWDIR” for the name, and your LDraw diresctory for the value. Your Ldraw directory is the directory containing the LDraw program, along with ldconfig.ldr.
HTH

ROSCO

   
         
   
Subject: 
Re: img2sticker: Convert images into .ldr stickers
Newsgroups: 
lugnet.cad
Date: 
Fri, 7 Oct 2005 06:28:58 GMT
Viewed: 
2256 times
  

In lugnet.cad, Ross Crawford wrote:

   LDRAWDIR is an environment variable which must be set to run the program. I assume img2sticker.pl uses the colours defined in ldconfig.ldr in that directory. To set it in XP:
  1. In Control Panel, choose “System”
  2. On the Advanced tab, click “Environment Variables”
  3. Click “New” and in the dialog box enter “LDRAWDIR” for the name, and your LDraw diresctory for the value. Your Ldraw directory is the directory containing the LDraw program, along with ldconfig.ldr.
HTH

ROSCO

Thanks, that took care of it. I’m still having trouble though. Everything I convert, including the ghanlogo.bmp that came with the download, comes out messy triangles. Nothing really recognizable. I may have to play with this while I’m more awake.

-Elroy

   
         
   
Subject: 
Re: img2sticker: Convert images into .ldr stickers
Newsgroups: 
lugnet.cad
Date: 
Fri, 7 Oct 2005 10:10:13 GMT
Viewed: 
2601 times
  

  
Thanks, that took care of it. I’m still having trouble though. Everything I convert, including the ghanlogo.bmp that came with the download, comes out messy triangles. Nothing really recognizable. I may have to play with this while I’m more awake.

-Elroy

The problem is that the triangulation routine is not very good. It can usually be tricked to find a triangulation at some point but basically it is just not very good at it. If I ever get around to finishing the C++ version it will do a much better job as it uses a proper routine.

To get the Ghan logo to work, reverse the colours (ie, use white as a background and red as a foreground). This trick often works as the code has real troubles finding triangulation around holes.

Sorry about that.

Tim

 

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR