Canvas data Export fabric.js - imagemagick

i want to know that what is the good method to export the data for Canvas with fabric.js,
Let's say, I have four images, 123.ai, 123.eps, 123.svg, 123.jpg. Now while adding on Canvas, with imagemagick I am converting it to png, So all the images will converted to .png extension, and then with .toSvg method I am exporting the Canvas data, So in SVG i am getting the reference path of the png files only, which are converted and added to the canvas. Now Actually while opening in illustrator, SVG takes references of png files instead of original files, So is there any ways I can retain original files while using method .toSvg . So i can direct open in illustrator, While If i make any in .Ai file, so that update would automatically updated in SVG file, if it takes the reference of original files instead of converted png file.
Or is there any way i can use another method?

First of all fabric js is working perfect with illustrator saved file. So if there is any file saved with illustrator in any format will have accurate output in canvas.
Second thing, as you said, that you are also working with SVG files. So it is ideal way to add SVG files to canvas and export canvas to SVG so you will not have any reference to any PNG files. you have smooth and straight forward way that you will add SVG files and export SVG file.

Related

Using Jupyter notebook with LaTex. Images not exported to pdf via LaTex

New to Juypter, trying to use it with Latex. Everything works fine except for the images. I used this tutorial: https://www.youtube.com/watch?v=m3o1KXA1Rjk&t=149s
Png Images are fine in markdown, i.e
But LaTex cannot determine size of png images. If I save the image as pdf I get the same issue. If I save the image as eps then LaTex complains that it cannot convert eps to pdf.
Has anyone had this issue? Anyone know how to solve it?
PNG images always contain the size in pixels.
Optionally, they can include a chunk of data named pHYs. This contains the resolution of the image. If this chuck is present, you should be able to find the actual text pHYs in the file.
If this chunk is missing from the PNG file, the scale of the image can not be found.
If you are on a UNIX-like operating system you could use grep or hexdump to check for the text pHYs in the PNG file. The identify program from the ImageMagick suite also can display the resolution of PNG images.
Note that there is an error in the video. The author first uses latex and then pdflatex three times. That is not a good idea, since they have different capabilities w.r.t. graphics. Stick with pdflatex.

Error while loading pvr.ccz textures in iOS

I'm using TexturePacker to create my sprite sheets for my iOS game. Everything is working fine with generated PNG textures (RGBA 4444), the textures are correctly loaded inside my code and correctly displayed on the iPad screen but as soon I remplace those textures by the PVRC format (pvr.ccz) with PVRTCI 4bpp RGBA pixel format, I get the following message for each of my textures from the console:
"SKTexture: Error loading image resource: "/var/containers/Bundle/Application/657D8692-594C-4180-AA8B-6CE35962C8D5/FurryLight Puzzles.app/Puzzle0.atlasc/Puzzle0.2.pvr.ccz"
The textures generated by TexturePacker are all POT and SQUARE format (2048x2048 max), the plist files are inside my directories .atlasc with the pvr.ccz files. In fact, I just replace the precedent .atlasc directories inside my tree shader inside Xcode with the PNG files by the new .atlasc directories with pvr.ccz files. All my code is in Swift 3.0
What am I missing, is there something to tune somewhere ? The pvr.ccz textures are correctly displayed by Xcode when I click on them inside the tree.
Here is the reply I got from the creators of TexturePacker:
"I am currently not sure if pvr works - you can try it. But pvr.ccz surely does not work.
pvr.ccz is a special format for cocos2d(x). It compresses the pvr files with zlib. This is not supported by SpriteKit.
Best
Andreas
"

Does iOS support SVG Tiny?

I try to use svg file as some element's background image. When I save image as SVG 1.0/1.1 in Adobe Illustrator, it displays correct in my app. If I save image as SVG Tiny 1.1/1.1+/1.2 it doesn't displays in app.
I use next css:
background-image: url(img.svg);
Does iOS support SVG Tiny? Or what I must to do, that my SVG Tiny image will display in app as background image?
Yes, iOS and pretty much any browser/device that supports SVG also supports SVG Tiny. However, SVG Tiny is a subset of SVG intended for devices with poor performance, it will discard gradients, opacity, embedded fonts and filters. What is probably happening is that the features you are using in your file are being discarded by the Tiny format. SVG Tiny does nothing to save on file size.
In summary, just use SVG 1.1.

How to save UIImage as a SVG file

The image draws with bezierPath, and I want to save it as a SVG file.
The format I can see are PNG or JPG.
You can't, at least not while using UIImage. Read the class doc...
UIImage Class Reference
Supported Image Formats
Table 1 lists the file formats that can be read by the UIImage class.
Supported file formats
Tagged Image File Format (TIFF)
.tiff, .tif
Joint Photographic Experts Group (JPEG)
.jpg, .jpeg
Graphic Interchange Format (GIF)
.gif
Portable Network Graphic (PNG)
.png
Windows Bitmap Format (DIB)
.bmp, .BMPf
Windows Icon Format
.ico
Windows Cursor
.cur
X Window System bitmap
.xbm
However, this kit may help...SVGKit. It interacts with Core Animation.
If you have a bezier path, you do not want to save it via a UIImage. You can convert it directly to an SVG path string, and insert that SVG path into an SVG document.
See for instance this answer: Converting UIBezierPath to SVG answer

Only convert images of a certain file type with paperclip styles

I want to convert uploaded images that are not jpegs or pngs to to be jpegs or pngs using paperclip. Problem is i dont want to convert jpegs to pngs or pngs to jpegs, just leave them as the file type they are.
Is this possible ? If so how do i create the styles all in jpeg or png ?
Also what is the best file type to save as? I cant convert some pngs to jpgs as if they had transparency in that gets lost / changed. Also if i change all to png is not bigger and alos i am using Prawn pdf outputting these images so cant use gif.
Any pointers anyone ?
Thanks alot
Rick
In order to do this you will need to create a custom Paperclip::Processor. You can probably subclass the Paperclip::Thumbnail in doing so.

Resources