Is it possible to convert strokes to fills in gs? - ghostscript

Is there any option to tell gs to convert strokes to fills? Something similar to the "Expand" feature of the Adobe Illustrator? Thanks in advance.

You can't convert strokes to fills, no.
You can use the strokepath PostScript operator, this will replace the current path with a path which encloses the shape that would be drawn if 'stroke' was applied to that path.
The result of strokepath can be used for fill, clip and pathbbox operations, but is not itself suitable for stroking.
Its completely unclear to me why you would want to replace a stroke with a fill, since the two will cover exactly the same area. I'm not at all familiar with Adobe Illustrator so using it as an example doesn't help me. Perhaps you could explain what it is you really want to do, and why you can't do it in the application producing the PostScript, which is almost always a better solution.

Related

How to remove regular strips

I want to remove the regular strips of the image as shown as follow. I try many methods, and they do not work, such as image media filter and FFT filter.
Could you tell me how to remove the strips?
All that black is removing a ton of information from the image. You have two options available - either re-capture that missing information in a new shot, or attempt to invent / synthesize / extrapolate the missing information with software.
If you can re-shoot, get your camera as close to the mesh fence as you can, use the largest aperture your lens supports to have the shallowest possible depth of field, and set your focus point as deep as possible - this will minimize the appearance of the mesh.
If that is the only still you have to work with, you've got a few dozen hours of playing with the clone and blur tools in front of you in just about any image editing software package you like.
Photoshop would be my go to tool of choice for this. In Photoshop CS5 they introduced something called content aware fill. I'm not sure if it will help you in this specific case because there is SO MUCH black that Adobe's algorithm may think other parts of the mesh are valid sources for filling in the mesh you're trying to clear out.

How to trim images with Imager

I use the Perl Imager library to process images.
I am trying to do something similar to the trim operation in ImageMagick or autocrop in GIMP: eliminate empty white space at the borders of the image.
Is there such a thing? I've searched the documentation but found nothing.
I think you are out of luck regarding a prewritten Imager method to do what you want. But I have looked at what the C API has to offer and I think it should be reasonably simple to write an XS extension to do the job.
My approach would be to pick apart the ImageMagick code for the Trim function and implement it in terms of the Imager API, which defines an i_gpix function to determine the colour of individual pixels.
Rather than duplicate the function of the Imager crop function, I would choose that the XS code returned left, right, top, and bottom margin sizes that could be passed directly to the existing crop.
Not what you were hoping for, I know, but well within the bounds of possibility.

How could I find a color that complements another programmatically?

Given any (user selectable) color, I am trying to generate a matching color to go with it for a user interface.
Basically, it should be a color that is either similar, or complements it very well - but, it must also be easily distinguishable from the first color. So far, I have tried lightening/darkening the color, which works ok - but it doesn't look the best, I am not convinced that there is no better way to do it.
What are some alternative or better ways that I could achieve the desired effect? Any help is much appreciated!
-
Side note - I have the color in both RGB and HSL formats, although could easily convert to others if need be.
Would it be possible for you to use this site below to help you reverse engineer the concept you are looking for?
http://colorschemedesigner.com/
It's flash so you can't see the code, it still might help though.
If you can figure out how to produce a colour wheel, then complementary colours are on opposite sides of the wheel.
Update
Wikipedia has useful pages on hue, hsl and hsv
http://en.wikipedia.org/wiki/Hue
http://en.wikipedia.org/wiki/HSL_and_HSV
and more on conversions
http://130.113.54.154/~monger/hsl-rgb.html

How can I go about extracting the background from an image?

Basically, suppose that I have a fingerprint. I know the dimension of my image, and I know that the fingerprint is black on a white background or that it is green on a black background or something like that.
Is there a way to process only the parts that delimit the image, in this case, the fingerprint? What I'm trying to do is basically this:
1) Delimit fingerprint
2) Extract the important points to compare to other fingerprints
3) Find best match on a database of other fingerprints that had their points previously extracted
I already have methods for 2 and 3, so now I just would have to delimit the image.
Programming language would have to be Ruby, Java or C++. Ruby preferred, then Java, and God help me if I have to use C++. I don't have any experience with image processing, but I'd like to do this with multiple common formats such as jpg, gif, png, if possible.
I think that the best way to do it is applying a edge detection filter to your image.
There are may approaches as suggested by wikipedia (article), but noone of them is trivial because they work on gradients or kernels. You should check Canny Edge Detection that should be enough straight-forward to implement: tutorial.
In any case if you want to avoid going deep into implementation details you should use OpenCV that is a computer vision library able to do these things in a simple way. You can use it for sure in C++ and Java but I think that a wrapper for Ruby is offered too. This is a simple example using that library with Canny algorithm.
EDIT: actually my answer covers point 2-3, so I'm wondering what you mean by delimiting the image? Think about the fact that scaling or rotating must be considered too if you want to compare different fingerprints: you need a fuzzy comparator.. maybe you should work on the Fast Fouried Transform version of the image that can handle such things in a better way.
An easy approach could be using threshold, like:
Convert your image to grayscale - so you have fingerprint in white on black.
Find a threshold value that gets most of the fingerprint.
Use open operation (http://en.wikipedia.org/wiki/Mathematical_morphology) to remove noise.
(experiment with dilate a few times)
Find the center of gravity (x,y) of the image and the standard deviation (vx, vy).
In the box:
[x-2vx,y-2vy],
[x-2vx,y+2vy],
[x+2vx,y+2vy],
[x+2vx,y-2vy]
You will find 95.4% of the pixels
You could narrow the box down to find the actual max and min pixels in it, if you have many outliers.
Use the box to clip from the original image.
It is simple method that might work well for your situation :)

How do you crop an image in Expression Blend?

I know this is leaning more in the direction of a designer question, but as I am faced with developing something which requires me to crop an image, I thought I would give the question a shot.
This seems like a ridiculous question to ask, but I've look all over the IDE (Expression Blend 2) to try and find a way to crop my image, but I can't figure it out.
This seems to be very much in line with Joel's question and is discussed in Podcast 58 in the sense that I'm a complete noob when it comes to designing in Expression Blend. I am adamantly interested in figuring out the most efficient way to do this. I found an article that describes a work flow you can go through that will produce a crop, which I added as an answer below, but I'm really hoping someone else will know of a quicker (less clicks) way to do something as trivial as this.
Does anyone know how this can be done?
As far as I know, there's no way to crop an image directly in expression Blend. Blend is not an image editing application. You need another tool for that.
What you can do though, is clipping an image if you only want to show a portion of it. Just add a rectangle on top of it right-click it, go to path -> make clipping path.
alt text http://img200.imageshack.us/img200/7370/example1.jpg
Now select the System.Windows.Controls.Image entry from the list you want to apply the clipping on and hit Ok
You can even use rounded rectangles, circles and custom paths to clip, but in most cases a rectangle will do the trick.
Just ran into another way.
Have a look at this question. It uses a CroppedBitmapClass as the source of an image. It's not actual drawing in Blend, but you can add it by hand editing Xaml. From your question it's not clear if you are creating a Silverlight or a WPF application in Expression Blend. The CroppedBitmapClass is available in WPF only.
With the new Silverlight 3 you can use the WritableBitmap to do image cropping:
I found an article that has steps to do an image crop, but it's very drawn out to do such a simple operation. You would think something that MS Paint can do in a couple button clicks would be similarly easy in Blend.
Here's the link.
I'm still wondering if there's an easier way to do this, however.
The other problem with this approach is that afterwards, I can't change the size of the rectangle that I'm cropping the image with, which I need to be able to do, because I have to have the image be an exact number of pixels in width and height.

Resources