View numpy array as image while debugging in PyCharm? - image

Is it possible to view numpy array as image while debugging in PyCharm?
I tried to enter
PIL.Image.fromarray(my_data, 'RGB').show()
into watches, but got
PIL is not defined
error. This is probably because PIL was not imported in current module.
Any other way appreciated. May be can write my own viewer or something?

I've just created OpenCV Image Viewer Plugin, which displays image while debugging just on click. You can install it to any JetBrains IDE, which support Python (directly or via plugin).
https://plugins.jetbrains.com/plugin/14371-opencv-image-viewer

I was able to import packages with semicolon, and was able to show image with expression like below:
import matplotlib; matplotlib.pyplot.imshow(mydata)

Related

Tkinter surface is displayed wrong in exe

I'm already trying to fix this for hours but it doesn't work.
I converted my python script to an exe-file. Via pyinstaller and via cx_freeze. But both have the same problem: They display the surface in the wrong way. I include canvas as FigureCanvasTkAgg and when I run it with Spyder it is displayed well. (I tried to place them via .place() and via .pack() ). But with the exe it's all above another and it displays only one of all the canvas (when I enter data for a chart).
Can somebody tell me how to correct this? Is there a way to convert the file to an exe like I can display it via Spyder?
Thank you!!
Displayed in exe: everything is overlapping
Here displayed how it should be

How can I import a single font-awesome icon?

I am attempting to import fa-carot-down, but I don't want to import the whole library. I need a single icon, but I'm not sure how to include it.
I'm using Webpack and SASS, if that makes any difference.
Alternatively, any means to get a carot icon for my dropdown would be appreciated.
You can try IcoMoon and Fontello as it helps you create your own library of fonts.
Furthur you can bundle it together with webpack to import the necessary icons
Now svg's are supported in IcoMoon

Convert Jupyter notebook to PDF - pdflatex not found on PATH

I'm trying to download my Jupyter notebook as a PDF from the web interface by going to:
File -> Download as -> PDF via LaTeX
However, I get this error:
nbconvert failed: pdflatex not found on PATH
I have both pandoc and MacTex installed. Additionally, in the terminal the pdflatex is set.
$ which pdflatex
/Library/TeX/Distributions/.DefaultTeX/Contents/Programs/texbin/pdflatex
I'm running on Mac OS X El Capitan using Jupyter 4.2.0 with Python 2.7.11
Print it to pdf using your browser (ctrl+p). It is simple and the "you print what you see" approach is great to share a reports/analysis with people that do not code or use the jupyter enviroment. Not publication ready by any means but gets the job done. Just make sure your plots and figures are not on interactive mode otherwise they will not be displayed (set them to %matplotlib inline).
I always had trouble with exporting my jupyter nb to pdf through latex. Quick search and you see that A LOT of people do. I could get some stuff worked out but the formatting was lackluster with code and plots not displayed the way I wanted. I eventually accepted that the jupyter notebook could not produce "publish-ready" pdfs easily. When I want that, I generate plots/figures/code on jupyter and call them on a latex file.
You may want to hide some of your code from the pdf, set the resolution of your plots and add some extensions to improve your jupyter documents.
If you really want to make your publications from inside jupyter, this tutorial has some great tips.
I've had a lot of luck exporting to HTML instead of pdf. HTML is similarly viewable by any non-developers in your organization, assuming they have a browser, and you can make use of some excellent tools like toc2, which gives your viewers a table of contents so they can stay oriented with what they are reading. You can also link to specific sections using the "#" symbol to do header links. Similarly, HTML supports interactive plotting like those available through plotly, so that end-users can zoom into graphs and other figures. Encourage you to give it a shot. Example code with nbconvert below:
jupyter nbconvert --to html --template toc2 --TemplateExporter.exclude_input=True "<path-to-ipynb>"
If its really necessary to have a pdf, you can then open your html in Chrome or Firefox and print to pdf that way. Hope it helps!

Xcode can't import PDF asset

Since Xcode6 can use vector assets, our designer starts to export PDF format assets instead of PNG. this's very very convenience but I found that I can't import PDF through "import action" by right click, see the PDF files is unavailable state with gray color:
And I can import it by dragging it directly.
Is there anything I am wrong?
Please check the following link, it might be of help : http://martiancraft.com/blog/2014/09/vector-images-xcode6/

How to export an image from Matlab without using toolbox?

I can import an image using importdata function, but how can i save the image after processing it?
Toolbox usage is prohibited.
You would use imwrite(imageData,filename). Documentation can be found here.

Resources