How to extract bitmap from .ico - actionscript

using actionscript 3, how can I extract the bitmap from a .ico file? ( preferably in .png format )

I have not tested this library but it seems to do what you are attempting:
http://www.libspark.org/svn/as3/ICODecoder/src/com/voidelement/images/ico/
Here is a link to a blog post demonstrating implementation:
http://ntt.cc/2008/10/02/using-icodecoder-class-to-read-ico-file-and-display-it-as-bitmap-in-actionscript.html

Related

How to create animated GIF files, from bitmaps, that are compatible with all media-players?

I am trying to create an animated GIF file from 8 bit-pixel bitmaps, and save it in a format compatible with Windows Media Player and VideoLan VLC, using Anders Melander's GIFImage.Pas library and Graphics system library.
The result, for now, is a file that contains no errors, but is not animated. How can I save a series of 8-bit-pixel TBitMap images to an animated GIF file?
Here is the test library:
Unit Prova;
(* This GIF saving test make a GIF file that can't be opened with
Windows Media Player nor VideoLan VLC,
because it seems to has some errors *)
Interface
Uses Graphics,GIFImage; (* Copyright: (c) 1997-99 Anders Melander *)
Procedure SaveBitmaps(Picture1,Picture2,Picture3:TBitMap
(* Same graphics resolution, 8 Bit Pixel + Palette *);
GIFFN:String);
Implementation
Procedure SaveBitmaps(Picture1,Picture2,Picture3:TBitMap
(* Same graphics resolution, 8 Bit Pixel + Palette *);
GIFFN:String);
Var GIFImg:TGIFImage;
Begin
GIFImg:=TGIFImage.Create;
GIFImg.AnimationSpeed:=30;
GIFImg.Transparent:=False;
GIFImg.Animate:=True;
GIFImg.Width:=Picture1.Width;
GIFImg.Height:=Picture1.Height;
Try
GIFImg.Add(Picture1);
GIFImg.Add(Picture2);
GIFImg.Add(Picture3);
GifImg.OptimizeColorMap;
GifImg.Optimize([ooMerge,ooCrop],rmNone,dmNearest,0);
GIFImg.SaveToFile(GifFN);
Finally
GIFImg.Destroy;
End;
End;
End.
I've created a .GIF animated file named "Treno.Gif" that contains 320 frames at 8 bit-pixel, 320 pixel width and 200 pixel width, with this method, and i've tested it on the web at:
gif debugger world's simplest gif tool
The error that occours is:
Error: TypeError: Cannot read properties of null (reading 'delay')
The file is:
Treno.Gif
It was created with a tool, named Anim32, which I am still developing;
you can find it at:
Anim32 V.093
and help me solve any problems with the GIF format.
WARNING: I Want to use GIFImage.pas unit, made by Anders Melander, Filip Larsen and Reinier Sterkenburg and
not GIFImg that it is included in Delphi 2007 package!
The solution of Andreas Rejbrand:
Delphi TGIFImage animation issue with some GIF viewers
it is certainly valid, but, as I wrote, I need to use gifimage.pas and not gifimg.

Setting styles for embedded fonts in jsPDF

i have an issue with generating pdfs in regards to embedding fonts. I just used
pdf.addFileToVFS('Acme-Regular-italic.ttf', fontBase64Data);
pdf.addFont('Acme-Regular-italic.ttf', 'Acme', 'italic');
pdf.setFont("Acme", 'italic');
pdf.text("italic Acme", 10, 10);
pdf.addFileToVFS('Acme-Regular.ttf', fontBase64Data);
pdf.addFont('Acme-Regular.ttf', 'Acme', 'normal');
pdf.setFont("Acme", 'normal');
pdf.text("regular Acme", 10, 40);
pdf.addFileToVFS('Acme-Regular-bold.ttf', fontBase64Data);
pdf.addFont('Acme-Regular-bold.ttf', 'Acme', 'bold');
pdf.setFont("Acme", 'bold');
pdf.text("bold Acme", 10, 70);
where fontBase64Data is always the Acme.ttf encodes as base64
and the font i see for the three variants is always the same!? So I wonder what I am missing. Do I need to pass different base64 encodingds (one for regular, one for bold...) - whcih I don't have? If so where can I get those?
Here the result i get as screenshot from pdf:
Cheers
Tom
Base64 is one input file one output file so if its built from command
base64 -e upright.ttf fontBase64.Data
then on decoding that string it can only be one single upright.ttf
For each family style you wish to embed you will need separate font ttfs
normal.ttf
italic.ttf
bold.ttf
bold italic.ttf
the preferred method is supply the regular/normal.ttf italic/oblique.ttf and bold/heavy.ttf etc. to the converter per the web site method
https://rawgit.com/MrRio/jsPDF/master/fontconverter/fontconverter.html
but do read the instructions at https://github.com/parallax/jsPDF#use-of-unicode-characters--utf-8
in return you will get the base64 style in a js wrapper
one advantage of holding the data in a referenced fontstyle.js is that the decompressed ttfs do not need to be included inline on the pdf building html page just linked like any other resource.

How do I put custom image on 3D Sphere in ARCore

The following is my code for building a 3D Earth and showing it:
com.google.ar.sceneform.rendering.Texture.Builder builder= com.google.ar.sceneform.rendering.Texture.builder();
builder.setSource(context,R.drawable.earth);
builder.build().thenAccept(texture ->
MaterialFactory.makeOpaqueWithTexture(context, texture).
thenAccept(material -> {
earthSphereRenderable =
ShapeFactory.makeSphere(0.1f, new Vector3(0.0f, 0.0f, 0.0f), material);
Toast.makeText(context,"All done",Toast.LENGTH_SHORT).show();})
);
The Toast message is coming but I am not able to see any object. Please note that R.drawable.earth is the Earth.jpg file that I put in there, which I want to show in AR.
Here is where I am rendering it
cornerNode = new Node();
cornerNode.setParent(this);
cornerNode.setLocalPosition(localPosition);
cornerNode.setRenderable(earthSphereRenderable);
Moreover, if I replace makeOpaqueWithTexture with makeOpaqueWithColor and but color as Red then the whole thing is working fine (i.e. I can see the sphere)
What must I change here in order to be able to see the sphere with Earth's texture on it?
At this time Google Sceneform 1.8 supports 3D assets in the following formats: .obj, .glTF for which animations not supported) and .fbx with or without animations. Supported textures' formats are: .mtl, .bin, .png and .jpg.
To import a new 3D asset with textures follow these steps:
Verify that your project's app folder contains a sampledata folder. To create the folder, right-click on the app folder in the Project window, then select New > Sample Data Directory.
The sampledata folder is part of your Android Studio project, but its contents will not be included in your APK. Copy your 3D model source asset file (.obj, .fbx, or .gltf), and all of its dependencies in any of the following formats:
.mtl
.bin
.png
.jpg
into the sampledata folder.
Do not copy these source files into your project's assets or res folder, as this will cause them to be included in your APK unnecessarily. Right click the 3D model source asset and select Import Sceneform Asset to begin the import process.
The values are used by the sceneform.asset() entry in the app's build.gradle, and determine where the .sfa and .sfb – ascii and binary asset definition – files (as well as their corresponding texture files .sfm) will be generated in your project. If you're importing a model for the first time, use the default values.
Hope this helps.
Ok, I got the answer to this. It does not accept jpg files but it accepts png files. Weird stuff!

Objective C and SVG

I am receiving a SVG back from our server that I need to display. What the server is returning is:
preview = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"256\" height=\"256\" preserveAspectRatio=\"xMedYMed meet\" viewBox=\"-10756457.3242036 -5943062.39021874 1277.60796701722 1244.16676712781\">\n <path d=\"M -10756407.324203580617905 -5942993.280961670912802 L -10756388.214946510270238 -5941880.166737286373973 -10755229.716236563399434 -5941868.223451617173851 -10755244.048179365694523 -5942728.140019812621176 -10755394.533578801900148 -5942730.528676947578788 -10755396.922235935926437 -5943012.390218744985759 -10755578.460178112611175 -5943005.224247347563505 -10755671.617806335911155 -5942995.669618809595704 -10755764.775434559211135 -5943005.224247347563505 -10755845.98977711237967 -5942990.892304535955191 -10755958.256662406027317 -5943000.446933076716959 -10756166.069833055138588 -5943002.835590209811926 -10756216.231632867828012 -5942998.058275939896703 -10756261.616118412464857 -5942990.892304535955191 -10756347.607775231823325 -5943002.835590209811926 Z\" stroke-width=\"1\" fill=\"black\" stroke=\"black\">\n </path>\n</svg>";
I am looking at the library the SVGKit. I'm not exactly sure what I can do with this information. Can SVGKit load this type of data or does it need to be a local SVG file?
We want to use this SVG cause its a lot smaller then a .png and the server is returning lots of them.
Any ideas on what I can do?
According to the documentation you can load an SVG file from data which is what you have.

convert jpeg/png to tiff in java

I am using batik library for image conversion , I need to convert jpeg/png to tiff format.
Can anyone help me on how to do the conversion using batik (preferable) , because i am using the same library for other SVG conversions.
You could probably do PNG - > SVG - > TIFF conversion.
This link should point you in the right direction:
http://xmlgraphics.apache.org/batik/tools/rasterizer.html
check the "Examples of using the rasterizer task" section.
Hope this helps.

Resources