| | | | |
Dear all,
Following up from my teaser the other day,
Ive 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 GPLd so if anyone wants to mess with it, please do!
| | | | | | | | | | | | | In lugnet.cad, Timothy Gould wrote:
|
Dear all,
Following up from my teaser the other
day, Ive 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 GPLd so if anyone wants to mess with it, please do!
|
Looks interesting, Im going to give it a go, might be a steep learning curve
tho!
cheers
Tim
| | | | | | | | | | | | | | | | | | Right, suffered my first set-back :(
Ive downloaded and installed Perl OK (Im using Windows XP)
I downloaded and unzipped img2sticker to a folder called D:Img2Sticker but then
I cant 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
Im not certain from this which path it is that it cant find and also why it
thinks there isnt an LDRAWDIR path.
Any ideas?
Tim
| | | | | | | | | | | | | | | | | | | |
| |
| 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
| | | | | | | | | | | | | | | | 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. Its probably easier to let your image
editing program get rid of the antialiasing. If youre 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. Theres 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 wont find it in Paint, of course.)
--Travis
| | | | | | | | | | | | | | | | | | | 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. Its probably easier to let your image
editing program get rid of the antialiasing. If youre 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. Theres 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 wont find it in Paint, of course.)
--Travis
|
Wow! Such a simple and practical solution. Added to the start of the tutorial.
Tim
| | | | | | | | | | | | | | | | | | | | 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. Its probably easier to let your image
editing program get rid of the antialiasing. If youre 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. Theres 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 wont find it in Paint, of course.)
|
Also, Bob
Kojimas 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
| | | | | | | | | | | | | | | | | | | | 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, its actually antialiasing, not aliasing. Aliasing (aka
jaggies) is the problem that antialiasing solves. And youre right; its 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
| | | | | | | | | | | | | | | | | | | | 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, its actually antialiasing, not aliasing. Aliasing (aka
jaggies) is the problem that antialiasing solves. And youre right; its
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 Id 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
| | | | | | | | | | | | | | | | | | | | 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 dont think so. Traditional antialiasing spreads the partial
pixel errors from a line (or edge) into the adjacent pixels. In order
to undo it youd need to know where the line is, but thats the very
information youre trying to recover from the image.
In this case youre 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.
|
Im 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
| | | | | | | | | | | | | | | | | | | |
|
Hmm, I dont think so. Traditional antialiasing spreads the partial
pixel errors from a line (or edge) into the adjacent pixels. In order
to undo it youd need to know where the line is, but thats the very
information youre 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 youre 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.
|
Im 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.
Will do,
Tim
| | | | | | | | | | | | | | | | | | | | | In lugnet.cad, Timothy Gould wrote:
|
|
Hmm, I dont think so. Traditional antialiasing spreads the partial
pixel errors from a line (or edge) into the adjacent pixels. In order
to undo it youd need to know where the line is, but thats the very
information youre 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,
youll 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.
| | | | | | | | | | | | | | | | | | | | | In lugnet.cad, Timothy Gould wrote:
|
|
Hmm, I dont think so. Traditional antialiasing spreads the partial
pixel errors from a line (or edge) into the adjacent pixels. In order
to undo it youd need to know where the line is, but thats the very
information youre 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 isnt a filter in that sense. When applied
to computer-generated graphics, its calculated during rendering using
information that isnt 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 cameras IR filter, apparently) and smoothing
algorithms. So even if you knew which form of antialiasing was used on a
particular image, I dont think you could create a filter to undo it.
--Travis
| | | | | | | | | | | | | | | |
| |
| 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
| | | | | | | | | | | | | | | | | |
| |
| 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
| | | | | | | | | | | | | | | | | | | | > 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
| | | | | | | | | | | | | | | | In lugnet.cad, Timothy Gould wrote:
|
Dear all,
Following up from my teaser the other
day, Ive 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 GPLd so if anyone wants to mess with it, please do!
|
Ive made a few attempts to use this, but Im not having much luck. Ive
installed Perl, and I think Im 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? Im attempting to run this from the
command line of a Windows XP machine.
-Elroy
| | | | | | | | | | | | | | | | | In lugnet.cad, Elroy Davis wrote:
|
Ive made a few attempts to use this, but Im not having much luck. Ive
installed Perl, and I think Im 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? Im 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:
- In Control Panel, choose System
- On the Advanced tab, click Environment Variables
- 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
| | | | | | | | | | | | | | | | | 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:
- In Control Panel, choose System
- On the Advanced tab, click Environment Variables
- 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. Im 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 Im
more awake.
-Elroy
| | | | | | | | | | | | | | | | |
|
Thanks, that took care of it. Im 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 Im 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
| | | | | | |