Export image of the plot by code - Netlogo - image

how can I export an image of the area of the plot by code?
I'm using Netlogo 5.0.5.
I'm tring to reproduce the comand "copy image" of menu right-button of the mouse in the area-plot in tag "Interface".

There is no primitive to export a plot as an image in NetLogo, which is admittedly a hole in the language. It would be fairly simple to write an extension to do that, but as far as I know, none exists.
That leaves you with two alternatives:
Use export-plot, which will give you a CSV file, and recreate your plot using some other tool (e.g., Gnuplot). This is more work, but it has the advantage of giving you better quality output in the end, NetLogo plots being kind of bitmappy anyway...
Use export-interface to export the whole NetLogo interface tab as an image, and then crop the resulting picture to keep only your plot. If you use a command-line tool like ImageMagick, this can be fully automated.
In both cases, you could try calling the external program that you choose directly from NetLogo by using the Shell extension.

Related

Any CLI tool to perform 3d texture mapping on the fly

I'm currently looking for a way to create a 'configurator' for a upholsters, similar to http://digitaldraping.com/configurator/furniture-sofa/?Cushions_Plain-Cream.png,Sofa_Stripe-Orange.png - you select your fabrics and they are 'drawn' on the sofa automatically.
Unfortunately, all the sites I've looked at seem to use pre-rendered transparent PNGs that are overlaid over each other to build up the full picture. The problem here is that we've figured out that we'd require over 120,000 different images to cover all models, fabrics etc!!
I've looked at a few 3d texture tools such as http://www.arahne.si/products/arah-drape.html, hoping that one of them would have a CLI option where you give it a pre-created wireframe, and a fabric to overlay, and it generates the required image on the fly, but so far everything seems to require real-time use of the GUI to use it.
So, is there a CLI tool that would do what I'm after, or can anyone suggest a way to manipulate the GUI automatically? (from a tech point of view, I'm comfortable with C, Bash, Python or PHP as a solution!)
Thanks!
ArahDrape 2.2 can now work from a command line without any GUI interface. You can also call ArahDrape as a C library. In this way, it can be used in a web server to create texture mapped images on the fly. The command line options are explained below.
ArahDrape 2.2j command line version, ©2015 Arahne
usage:
adCommand -o /tmp/outputImage.png -tN /home/user/texture.png [-hidemodel] [-divide 2] [-filterPNG] [-compressPNG 2] [-m /home/user/model.png] -owner name -activation 174b3cfb49e9 /home/user/project.drape
Input and output images can have png, .tif or .jpg extensions
-o output_image_file
-tN texture_image_file [N goes from 0 to 199]
-hidemodel will render all areas not in region as white
-divide N [N goes from 2 to 5] divide resulting image pixel size
-filterPNG if you do not filter it, rendering is faster
-compressPNG N [N goes from 0 to 9] lower number saves faster, but bigger files
-m model_image_file use this if you want to replace model image from the project; must have same pixel size
-owner owner_name pass the given owner name
-activation activation_code pass the given activation code
last parameter should be ArahDrape project file
All files should be entered with full path.
If you need spaces in filenames, use quotes "" around the filename.
If you provide only Owner name, without activation code, program returns registration code.
ArahDrape supports batch export.
Open ArahDrape project, click on texture you wish to replace, put all your texture in a directory, select from menu
Textures > Browse textures, and as you click the texture to load it, program will save the draped picture. If you have thousands of images, use keyboard shortcut = and program will automatically do them all.
Alpha channel transparency is supported in loading model images or textures, and saving the draped images, as long as you use PNG or TIFF.
Please check this video to see how
ArahDrape works in batch mode.
we (http://digitaldraping.com/) can do just what you are asking. We have two options creating images and rendering a meshed image on the fly. Just get in touch if you still need this solution.

GameDevelopment: Is there an equivalent to TexturePacker to optimize single images RGB format?

Might be a silly question. I am using TexturePacker to export texture sheets for my Cocos2d game.
At the end of certain levels I want to display a special image that tells the user that a new world is unlocked. I thought to create a single texture sheet in pvr.ccz RGB4444 format using some useful Dithering algorithm to optimize the alpha information in the image.
However I am wondering.. is this the best way to include an optimized image in the game? Or should I use GIMP/Photoshop etc.. to optimize and export it?
Yes, exporting image from TexturePacker is the best (and the simplest) way.
GIMP and Photoshop wont export to pvr.ccz.
Even simple images generated by Photoshop or GIMP, its better to add it to TexturePacker and export again.

Copy and paste or drag and drop plots as PDF from R in OSX?

Is there any device or OSX software that allows for copy/paste as PDF, like in Mathematica?
I can copy plots as bitmaps from Quartz devices in the standard GUI and (at arbitrary resolution) in RStudio, but there a frequent occasions when I want vector graphics.
Edit:
I am aware of PDF exporting and devices, but am interested in a somewhat quicker workflow. The purpose here is for class handouts, where I mostly just want those printouts to come out without the obvious jaggies. It's not sensible, I know (only class notes after all), but it drives me crazy. I quite like the Copy As PDF feature from Mathematica for this reason. It works nicely for putting the same plot in the notes and in Keynote.
RStudio will do it (look at Export -> Save Plot as PDF as Arun says above). Alternately you can export something as an image but choose .svg as the file type.
You can do this in base R depending on your graphics device and other stuff external to R. If you type:
> capabilities(what = "cairo")
cairo
TRUE
Then you can probably export as PDF or svg outside of RStudio. See help("svg") for an explanation of the functions and arguments.
Edit:
If you want to copy directly from the x11 device to the clipboard you can do this from the Edit menu in R. I don't think you can drag directly from an x11 device to a non-x11 app (because the clipboards are different). But Edit -> Copy should work as expected and you can then paste w/ Command + V (on mac) into whatever app you like. You can test this out by running R (not RStudio) and plotting something trivial like plot(1:10, 1:10) then copying the output as described above into an app. It should save as a pdf file.
The quartz device allows copying to the clipboard and pasting into Preview.app with "New from Clipboard" results in a PDF file. So I guess I don't really understand what the problem is.

Using images in Matlab GUI

I'm working on a small image processing project in MATLAB. I have worked with MATLAB before, but never created a GUI. The GUI I want to create could be pretty advanced, so I need some hints on how to get started.
The purpose of the GUI would be to load an image and have it shown to the user. The user then has to click on two points in the image, of which the coordinates are stored (in pixels) in a variable. If possible, a colored dot is shown where the user has clicked. After the user finished with the current image, he can load a next one.
I have some experience with Java, and I think this wouldn't be too hard in Swing. But MATLAB seems like not having the purpose of creating such an advanced GUI. However, the whole project until now is in MATLAB, so it would be nice if I could manage to do it. Any help? Hints? Things I should look at?
Thanks a lot.
This is not a very complex task to be done in MATLAB.
For simple instructions about adding a picture to a GUI, take a look at this post:
http://blogs.mathworks.com/pick/2007/10/16/matlab-basics-setting-a-background-image-for-a-gui/
For instructions on various interactions between GUI axes and the mouse pointer, check this video (keep in mind that your picture in the GUI lies within normal MATLAB axes):
http://blogs.mathworks.com/pick/2008/05/27/advanced-matlab-capture-mouse-movement/
In general, Doug's tutorial videos are great for MATLAB beginners, and I'd advise you to take a look at more of them.

Blurred colors using epsfig or graphicx in LaTeX

My code is simple enough, and importing eps images is something I've done before with other matlab-generated content, but for one reason or another I end up with blurred colors in my heatmap when I use epsfig or graphicx to import it into my document. In the picture below, the right is what shows up if I compile to DVI and open up the document in Yap, and the left is if I simply view the eps in GSView.
alt text http://img85.imageshack.us/img85/1694/epsproblem.png
Here is my code. This example is using graphicx, but the idea is the same with epsfig.
\begin{figure}
\centering
\includegraphics[scale=0.5]{images/ngram3_model_raw.eps}
\caption{The perplexity when compared
against the HUB test set}
\end{figure}
Is there perhaps some option I am forgetting?
I had the same problem with DVI, but if I compiled to pdf the pictures were fine
What you see is bilinear interpolation. It is done by the viewer. Probably Matlab defines the plot contents as a pixmap (I guess you use imagesc?).
The solution is not straightforward. It may help to use a different processing chain (as WtFudgE pointed out) that will lead the data end up in a format where it is not interpolated anymore. You may also use a different viewer that does not interpolate and I would assume that a printer would also not interpolate. This can again be dependent of the application you print from.
Sorry that I don't have a solution for you; at least you now have some new words to search for in Google. ;)

Resources