How to add image in Haxe? (without building image) - haxe

I maked source code like this
var sprite:FlxSprite = new FlxSprite(10, 10).loadgrphic('assets/images/test.png');
add(sprite);
and i added an image file in the builded file (I am making some tools)
but it shows haxefilxel logo
FileSystem.exists() is working successfuly.
Is theres no WAY to add image without building image?

Related

How to generate svg images using python 'quantstat' library

using quantstat library's report.py module, I am able to successfully generate .html images when I call quanstat.reports.html function, and quanstat.reports.full function to generate .png images for the various graphs, charts, reports.
https://github.com/ranaroussi/quantstats/blob/main/quantstats/reports.py
can someone help me at the earliest how to use the same 'report.py' module or other modules in this 'quantstat' library to generate images in .svg format so that they can be opened in any browser such as google-chrome.
Which files of this library need to be modified or enhanced with python code to successfully generate .svg files ?
following code is generating png images when I am passing file path to 'savefig' in my local. used VS Code as IDE
import quantstats as qs
stock1 = qs.utils.download_returns('XLE', period="1y")
stock2 = qs.utils.download_returns('SPY' , period="1y")
qs.reports.full(stock1, stock2)
how can I get images in .svg format using same qs.reports.full(stock1, stock2) ?

Why is bodymovin exporting PNG's and not SVG's?

I'm trying to use lottie to animate an SVG animation created in After Effects. I use the bodymovin extension to export the JSON data file. But, I also noticed the export includes some PNG images. I'm also getting console errors that said PNG's can not be found.
Why is it exporting PNGs as I'm using SVG (an AI file) in AE. Below is my code, and the error.
index.ts
import * as lottie from 'lottie-web';
import * as header from './assets/header.json';
import './css/base.sss';
var animation = lottie.loadAnimation({
container: document.getElementById('header'),
animationData: header,
renderer: 'svg/canvas/html',
autoplay: true
});
But I'm getting the following errors that the images can't be found. Why is bodymovin exporting/looking for pngs? I require SVG's.
Chrome console errors (sorry can't embed until 10 rep)
I found the problem. I have to convert paths to shapes in AI as noted here.
In Adobe After effect, you can use Create Shapes from vector layer
Another way I found was to search the exported .json file for the .png extension and replace the found extensions with .svg. Making sure to add the .svg files to the same directory.
I used this bodymovin render option:
I did my search in the .json file in Dreamweaver like so:
I hope this helps someone!!!

how to draw shapes in a PDF using NodeJS

I have some existing PDF files and what I want is to highlight some content by overlaying circles or straight lines. I've looked at some NodeJS PDF libraries but couldn't find a solution (some libraries allow creating a PDF from scratch and draw into it; other libraries can modify existing PDFs, but do not support drawing).
A (Linux / OSX) command line solution (e.g. using ImageMagick or some other library) would be perfectly fine, too.
Edit I've since found out that with Image/GraphicsMagick I can in fact do sth. like gm convert -draw "rectangle 20,20 150,100" xxx.pdf[7] xxx2.pdf, but this (1) either draws on all pages or else only on a single one, but then the resulting PDF will only contain that page; (2) the output PDF will contain a bitmap image where I would prefer a PDF with text content.
Edit I've just found HummusJS which is a NodeJS library to manipulate PDF files via declarative JSON objects. Unfortunately, apart from the scrace documentation, the unwieldy API (see below), the tests fail consistently and across the board with Unable to create PDF file, make sure that output file target is available.
completely OT not sure what it is that makes people think such utterly obfuscated APIs are better than simple ones:
var settings = {modifiedFilePath:'./output/BasicJPGImagesTestPageModified.pdf'}
var pdfWriter = hummus.createWriterToModify('./TestMaterials/BasicJPGImagesTest.PDF',settings);
var pageModifier = new hummus.PDFPageModifier(pdfWriter,0);
pageModifier.startContext().getContext().writeText('Test Text', ...
...
var copyingContext = inPDFWriter.createPDFCopyingContextForModifiedFile();
var thirdPageID = copyingContext.getSourceDocumentParser().getPageObjectID(2);
var thirdPageObject = copyingContext.getSourceDocumentParser().parsePage(2).getDictionary().toJSObject();
var objectsContext = inPDFWriter.getObjectsContext();
objectsContext.startModifiedIndirectObject(thirdPageID);
var modifiedPageObject = inPDFWriter.getObjectsContext().startDictionary();
A couple of helpers with HummusJS, to assist with what you are trying to do:
Adding content to existing pages - https://github.com/galkahana/HummusJS/wiki/Modification#adding-content-to-existing-pages
Draw shapes - https://github.com/galkahana/HummusJS/wiki/Show-primitives
using both, this is how to add a circle at 'centerx,centery' with 'radius' and border width of 1, to the first page of 'myFile.pdf'. The end result, in this case will be placed in 'modifiedCopy.pdf':
var pdfWriter = hummus.createWriterToModify(
'myfile.pdf',
{modifiedFilePath:'modifiedCopy.pdf'});
var pageModifier = new hummus.PDFPageModifier(pdfWriter,0);
var cxt = pageModifier.startContext().getContext();
cxt.drawCircle(
centerX,
centerY,
radius,
{
type:stroke,
width:1,
color:'black'
});
pageModifier.endContext().writePage();
pdfWriter.end();
General documentation - https://github.com/galkahana/HummusJS/wiki
If the tests fail, check that an "output" folder exists next to the script being executed, and that there are permissions to write there.

Wand Image from PDF doesn't apply resizing

I'm using wand in a Django project, to generate a thumbnail from different kind of files, e.g pdf, all the thumbnail generation process is done in memory, the source file is get from a request and the thumbnail is saved to a temporary file, then Django FileFiled saves the image in the correct path, but the thumbnail generated keeps the initial size, this is my code:
with image.Image(file=self.content.file, format="png") as im: # self.content is a django model FileField didn't saved yet, so the file inside is still in memory (from the request)
im.resize(200, 200)
name = self.content.file.name
self.temp = tempfile.NamedTemporaryFile()
im.save(file=self.temp)
self.thumbnail = InMemoryUploadedFile(self.temp, None, name + ".png", 'image/png', 0, 0, None) # then self.thumnail as FileField saves the image
Do you have any idea what happen? could be a bug? I've already reported it as issue on wand github page.
The problem comes from the fact that your PDF has more than one page. If you only resize the first page (which is the one you want to display), it works. Try adding the following line after your with statement:
im = image.Image(image=im.sequence[0])
But I agree with you that your version should work as well.

WPF C# Unable to find subfolder image resource

I have several images in an assembly that I have all marked as resource in their property setting.
For testing I put an image at the root of my project.
Img.Source = new BitmapImage(new Uri("pack://application:,,,/MyAssembly;component/image.png", UriKind.Absolute));
and it finds and loads the image just fine.
If I place the image in a subfolder no matter what folder or what level, it returns back that it is unable to find the resource.
The folder structure is Resources/Base/Weather/image.png
Img.Source = new BitmapImage(new Uri("pack://application:,,,/MyAssembly;component/Resources/Base/Weather/image.png", UriKind.Absolute));
When I run the application and try to load that image I get this error
Cannot locate resource 'resources/base/weather/image.png'.
Notice the lowercase on the folder names. I am at a loss as to what to try next. I have tried many variations including using the # but that doesn't help. I really do not want to load up the root directory with images.
Thoughts Anyone???

Resources