Write image on file and view.

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
einstein1969
Expert
Posts: 961
Joined: 15 Jun 2012 13:16
Location: Italy, Rome

Write image on file and view.

#1 Post by einstein1969 » 30 Nov 2015 11:52

Hi to all,

I need information for write on file a pictures and than reload with an external comand (standard/preinstalled software possible). What methods?

TIA

Einstein1969

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Write image on file and view.

#2 Post by foxidrive » 30 Nov 2015 15:56

einstein1969 wrote:I need information for write on file a pictures and than reload with an external comand


Can you ask that question in a different way? It's not clear to me what you are trying to do.

einstein1969
Expert
Posts: 961
Joined: 15 Jun 2012 13:16
Location: Italy, Rome

Re: Write image on file and view.

#3 Post by einstein1969 » 01 Dec 2015 05:30

OK. I try to explain.

I need a batch that write on file an image in a image format (PPM, BMP, PNG, TGA, ...). I need only the simplest format, but
the output must be reader by an system operating facility preinstalled.
For example i write to TGA in a file image.TGA than I call the "image viewver" of SO or I write a HTA file with a base 64 included image (if it is possible...) and then call the mshta for show the image... end so on.

einstein1969

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Write image on file and view.

#4 Post by foxidrive » 02 Dec 2015 17:27

I'm still a little unclear - do you want to create an image file and write text on a plain coloured background?
Does this need to be done with default tools in the OS? Which version of Windows is it for?

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: Write image on file and view.

#5 Post by Squashman » 02 Dec 2015 18:33

Maybe some screen shots of what you are trying to do would help.

miskox
Posts: 631
Joined: 28 Jun 2010 03:46

Re: Write image on file and view.

#6 Post by miskox » 03 Dec 2015 01:40

I think he wants to make a binary file (in his case an image file (PNG, JPG...)) with batch. With the help of this viewtopic.php?f=3&t=5326#p32108 here is a sample what he might want.

I will create a .png from Wiki (https://en.wikipedia.org/wiki/Portable_Network_Graphics, png image: https://upload.wikimedia.org/wikipedia/ ... adient.png)

First create a data file (.png dump) named INPUT_FILE.TXT:

Code: Select all

137
80
78
71
13
10
26
10
0
0
0
13
73
72
68
82
0
0
0
128
0
0
0
68
8
2
0
0
0
198
37
170
62
0
0
0
194
73
68
65
84
120
94
237
212
129
6
195
48
20
64
209
183
52
221
255
255
111
179
116
86
234
137
18
108
40
115
226
170
52
73
3
135
214
254
216
123
137
187
82
141
59
135
254
1
0
128
0
0
16
0
0
2
0
64
0
0
8
0
0
1
0
32
0
0
4
0
128
0
0
16
0
0
2
0
64
0
0
8
0
0
1
0
32
0
0
0
212
94
106
100
75
148
245
152
124
209
244
146
92
92
62
207
156
63
115
113
88
95
175
139
121
91
238
150
182
71
235
241
234
209
206
182
227
117
59
230
185
149
141
199
206
3
57
201
175
198
51
147
123
102
55
207
171
191
249
201
47
8
128
0
0
16
0
0
2
0
64
0
0
8
0
0
1
0
32
0
0
4
0
128
0
0
16
0
0
2
0
64
0
0
8
0
0
1
0
32
0
0
140
55
219
104
3
32
251
237
150
101
0
0
0
0
73
69
78
68
174
66
96
130


Here is .cmd:

Code: Select all

@echo off
rem create bin values
for /L %%L in (0,1,255) do call :createbinvalue %%L
break>png_image.png
for /f "tokens=1 delims=" %%f in (input_file.txt) do copy /b png_image.png+%%f.chr png_image.tmp>nul&move /y png_image.tmp png_image.png>nul 2>nul

del *.chr
png_image.png

goto :EOF

:createbinvalue
REM This code creates one single byte. Parameter: <int>0-255
REM Teamwork of carlos, penpen, aGerman, dbenham
REM Tested under Win2000, XP, Win7, Win8

set "options=/d compress=off /d reserveperdatablocksize=26"
if %~1 neq 26  (type nul >%~1.tmp
makecab %options% /d reserveperfoldersize=%~1 %~1.tmp %~1.chr >nul
type %~1.chr | (
(for /l %%N in (1 1 38) do pause)>nul&findstr "^">%~1.tmp)
>nul copy /y %~1.tmp /a %~1.chr /b
del %~1.tmp
) else (copy /y nul + nul /a 26.chr /a >nul)

goto :EOF


Start it and it will display

Image

with the default .png viewer.

Saso

miskox
Posts: 631
Joined: 28 Jun 2010 03:46

Re: Write image on file and view.

#7 Post by miskox » 03 Dec 2015 01:54

foxidrive wrote:I'm still a little unclear - do you want to create an image file and write text on a plain coloured background?
Does this need to be done with default tools in the OS? Which version of Windows is it for?


This would be great. I have such a program (I am not sure if I have a source - a friend made it):

I call the program with a parameter (text) and then this text is inserted on a white background - it makes an image file (CD background cover with this text on spines and border lines). It would be great to have a batch version. I think this program uses an API...

Here is a demo image (can we resize in a forum?):

Image

Of course a friend even added some parameters in a config file:

Code: Select all

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="LabelFontFamily" value="Tahoma" />
    <add key="LabelFontSize" value="5" />
    <add key="OutputDPI" value="300" />
    <add key="OutputFormat" value="png" />
    <add key="OutputFile" value="CoverBack.{0}" />
  </appSettings>
</configuration>


Saso

einstein1969
Expert
Posts: 961
Joined: 15 Jun 2012 13:16
Location: Italy, Rome

Re: Write image on file and view.

#8 Post by einstein1969 » 03 Dec 2015 04:58

Saso, you got it!

I have already used an file input in the PPM format that is not compress. It's not necessary dump the file, and display on the console.

But my final objective is not get image imput from a dump of image or image. I need to write an image from scratch in dos batch and write to file. Then direct load and preferible convert in base 64 to include in HTA ora HTML for load with mshta or browser.

Then i prefer format that are not compressed or have possibility to be compressed or not.

Einstein1969

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: Write image on file and view.

#9 Post by penpen » 07 Dec 2015 11:51

There are only three image formats supported by web browsers, that offers the ability to store the (pixel) data uncompressed:
BMP, TIFF, and SVG.

I prefer SVG, because its source could just be written into the html document.

But you could inline any image format; even internet media type (aka MIME type, content type) that actually has not been registered with IANA:
- PBM (image/x-portable-bitmap),
- PGM (image/x-portable-graymap),
- PPM (image/x-portable-pixmap),
- PNM (image/x-portable-anymap), and
- PAM (image/x-portable-arbitrarymap).

I've implemented an inlined BMP (because it is more common than TIFF):

Code: Select all

@if not "%~1" == "" goto %~1
@echo off
setlocal enableExtensions enableDelayedExpansion
>"test.html" <nul (
   echo(^<html^>
   echo( ^<head^>
   echo(  ^<title^>Test.^</title^>
   echo( ^</head^>

   echo( ^<body bgcolor=^"C0C0C0^"^>
   set /P "=<img src="data:image/png;base64,"
   call "%~f0" ":printHex" "logo_Ulf-1.png" "test.tmp"  | call "%~f0" ":hex2base64"
   echo(^" /^>

   set /P "=<img src="data:image/bmp;base64,^"
   call "%~f0" ":sampleBMP" | call "%~f0" ":hex2base64"
   echo(^" /^>

   set /P "=<img src="data:image/x-bmp;base64,^"
   call "%~f0" ":sampleBMP" | call "%~f0" ":hex2base64"
   echo(^" /^>

   set /P "=<img src="data:image/x-portable-pixmap;base64,^"
   call "%~f0" ":samplePPM" | call "%~f0" ":hex2base64"
   echo(^" /^>
   
   set /P "=<img src="data:image/x-portable-anymap;base64,^"
   call "%~f0" ":samplePPM" | call "%~f0" ":hex2base64"
   echo(^" /^>

   echo(^<svg xmlns="http://www.w3.org/2000/svg" version="1.1" baseProfile="full" width="30px" height="50px" viewBox="0 0 30 50"^>
   echo(   ^<polygon points=" 0, 4   4, 0   10, 0   6, 4" style="fill:#FF0000" /^>
   echo(   ^<polygon points=" 6, 4  10, 0  24, 0  20, 4" style="fill:#00FF00" /^>
   echo(   ^<polygon points="20, 4  24, 0  30, 0  26, 4" style="fill:#FFFF00" /^>
   echo(   ^<polygon points=" 0, 4   6, 4   6,50   0,50" style="fill:#DF0000" /^>
   echo(   ^<polygon points=" 6, 4  20, 4  20,10   6,10" style="fill:#00C000" /^>
   echo(   ^<polygon points="20, 4  26, 4  26,10  20,10" style="fill:#DFDF00" /^>
   echo(   ^<polygon points="26, 4  30, 0  30, 6  26,10" style="fill:#BFBF00" /^>
   echo(   ^<polygon points="26,10  30, 6  30,40  26,44" style="fill:#007F00" /^>
   echo(   ^<polygon points=" 6,10  10,10  10,20   6,24" style="fill:#BF0000" /^>
   echo(   ^<polygon points=" 6,24  10,20  20,20  20,24" style="fill:#00FF00" /^>
   echo(   ^<polygon points=" 6,24  20,24  20,10  26,10  26,44  20,44  20,30   6,30" style="fill:#00C000" /^>
   echo(   ^<polygon points=" 6,30  10,30  10,40   6,44" style="fill:#BF0000" /^>
   echo(   ^<polygon points=" 6,44  10,40  20,40  20,44" style="fill:#FFFF00" /^>
   echo(   ^<polygon points=" 6,44  26,44  26,50   6,50" style="fill:#DFDF00" /^>
   echo(   ^<polygon points="26,44  30,40  30,46  26,50" style="fill:#BFBF00" /^>
   echo(^</svg^>


   echo( ^</body^>
   echo(^</html^>
   
)

:exit
endlocal
goto :eof


:printHex
@echo off
shift /1
:: %%~1   filename
:: %%~2   dummy filename (temporary)
setlocal enableExtensions enableDelayedExpansion
<nul (
   for %%a in ("%~1") do >nul fsutil file createnew "%~2" %%~za
   set "actual=-1"
   set "hexLine= "
   for /F "skip=1 tokens=1-3 delims=: " %%a in ('fc /B "%~2" "%~1"') do (
      set /A "actual+=1"
      if not !actual! equ 0x%%~a (
         for /L %%A in (!actual!, 1, 0x%%~a) do (
            if %%~A EQU 0x%%~a ( set "hexLine=!hexLine! %%~c"
            ) else             ( set "hexLine=!hexLine! 00"
            )
            if not "!hexLine:~48,1!" == "" (
               echo(!hexLine:~2!
               set "hexLine= "
            )
         )
         set /A "actual=0x%%~a"
      ) else (
         set "hexLine=!hexLine! %%~c"
         if not "!hexLine:~48,1!" == "" (
            echo(!hexLine:~2!
            set "hexLine= "
         )
      )
   )
   del test.tmp
)
if not "!hexLine:~2,1!" == "" echo(!hexLine:~2!
endlocal
goto :eof


:hex2base64
@echo off
shift /1
:: assumed: blocked hexadecimal digit input stream from stdin
:: example stream (without doublequotes):
:: "01 23 45 67 89 AB CD EF"
:: any batch for set delimiters allowed

setlocal enableDelayedExpansion
set "base64=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
set "fillByte=="
set "buffer="

for /F "tokens=*" %%A in ('findstr "^"') do <nul (
   set "buffer=!buffer! %%~A"
   set "triple=0x"
   for %%B in (!buffer!) do (
      set "triple=!triple!%%~B"
      if NOT "!triple:~6!" == "" (
         set /A "d=(triple>>18)&0x3F, c=(triple>>12)&0x3F, b=(triple>>6)&0x3F, a=triple&0x3F"
         for /F "tokens=1-4" %%a in ("!a! !b! !c! !d!") do set /P "=!base64:~%%~d,1!!base64:~%%~c,1!!base64:~%%~b,1!!base64:~%%~a,1!"
         set "triple=0x"
      )
   )
   set "buffer= !triple:~2,2! !triple:~4,2!"
)

if "%triple:~2%" == "" (
   rem nothing left todo
) else if "%triple:~4%" == "" <nul (
   set "triple=%triple%0000"
   set /A "d=(triple>>18)&0x3F, c=(triple>>12)&0x3F"
   for /F "tokens=1-2" %%c in ("!c! !d!") do set /P "=!base64:~%%~d,1!!base64:~%%~c,1!%fillByte%%fillByte%"
) else <nul (
   set "triple=%triple%00"
   set /A "d=(triple>>18)&0x3F, c=(triple>>12)&0x3F, b=(triple>>6)&0x3F"
   for /F "tokens=1-3" %%b in ("!b! !c! !d!") do set /P "=!base64:~%%~d,1!!base64:~%%~c,1!!base64:~%%~b,1!%fillByte%"
)
endlocal
goto :eof


:sampleBMP
@echo off
shift /1

      rem bmp sample image:
      rem - 2x2
      rem - 255 colors
      rem - black, red
      rem - green, white

% hex offset %
      rem bmp header      byte order: little endian
% 00 %      echo( 42 4D      % signature %
% 02 %      echo( 56 06 00 00   % filesize in this case bmp_header.length+DIB_header.length+4*width*height %
% 06 %      echo( 00 00       % reserved1 %
% 08 %      echo( 00 00       % reserved2 %
% 0A %      echo( 7A 00 00 00   % pixel data map offset %

      rem DIB header      BMPv5
% 0E %      echo( 6C 00 00 00   % DIB header size %
% 12 %      echo( 1E 00 00 00   % pixel data map width %
% 16 %      echo( 32 00 00 00   % pixel data map height %
% 1A %      echo( 01 00      % number of color planes %
% 1C %      echo( 20 00      % 32 bits per pixel for ARGB %
% 1E %      echo( 03 00 00 00   % BI_BITFIELDS, no pixel array compression needed for alpha %
% 22 %      echo( 20 00 00 00   % raw data map size including padding %
% 26 %      echo( 13 0B 00 00   % horizontal pixels per meter; 72 DPI * 39.3701 inches per meter %
% 2A %      echo( 13 0B 00 00   % horizontal pixels per meter; 72 DPI * 39.3701 inches per meter %
% 2E %      echo( 00 00 00 00   % colors in palette %
% 32 %      echo( 00 00 00 00   % important colors, 0 all are important %
% 36 %      echo( 00 00 FF 00   % bitmask red   color channel %
% 3A %      echo( 00 FF 00 00   % bitmask green color channel %
% 3E %      echo( FF 00 00 00   % bitmask blue  color channel %
% 42 %      echo( 00 00 00 FF   % bitmask alpha color channel %
% 46 %      echo( 20 6E 69 57   % LCS_WINDOWS_COLOR_SPACE "Win " %
% 4A %      echo( 00 00 00 00   % CIEXYZTRIPLE Color Space endpoints; unused for choosen colorspace %
      echo( 00 00 00 00
      echo( 00 00 00 00
      echo( 00 00 00 00
      echo( 00 00 00 00
      echo( 00 00 00 00
      echo( 00 00 00 00
      echo( 00 00 00 00
      echo( 00 00 00 00
% 6E %      echo( 00 00 00 00   % red   gamma * 0x10000; red   gamma == 1.0 %
% 72 %      echo( 00 00 00 00   % green gamma * 0x10000; green gamma == 1.0 %
% 76 %      echo( 00 00 00 00   % blue  gamma * 0x10000; blue  gamma == 1.0 %

      rem raw pixel map   notes:
      rem                    color order: blue green red alpha
      rem                    pixel order: left to right
      rem                    line order: bottom to top
      rem                                    A            B            C            D            E            F            G            H            I            J
      rem                                    white        red1         red2         red3         green1       green2       green3       yellow1      yellow2      yellow3
% 7A %      rem                                    transparent
      for /F "tokens=1-10 delims=," %%A in (" FF FF FF 00, 00 00 FF FF, 00 00 DF FF, 00 00 BF FF, 00 FF 00 FF, 00 C0 00 FF, 00 7F 00 FF, 00 FF FF FF, 00 DF DF FF, 00 BF BF FF") do @(
         for %%a in (
            "6,%%~C" "20,%%~I"          "4,%%~A"
            "6,%%~C" "20,%%~I" "1,%%~J" "3,%%~A"
            "6,%%~C" "20,%%~I" "2,%%~J" "2,%%~A"
            "6,%%~C" "20,%%~I" "3,%%~J" "1,%%~A"
            "6,%%~C" "20,%%~I" "4,%%~J"
            "6,%%~C" "20,%%~I" "4,%%~J"
            "6,%%~C" "1,%%~D" "13,%%~H" "6,%%~F" "1,%%~G" "3,%%~J"
            "6,%%~C" "2,%%~D" "12,%%~H" "6,%%~F" "2,%%~G" "2,%%~J"
            "6,%%~C" "3,%%~D" "11,%%~H" "6,%%~F" "3,%%~G" "1,%%~J"
            "6,%%~C" "4,%%~D" "10,%%~H" "6,%%~F" "4,%%~G"
            "6,%%~C" "4,%%~D" "10,%%~A" "6,%%~F" "4,%%~G"
            "6,%%~C" "4,%%~D" "10,%%~A" "6,%%~F" "4,%%~G"
            "6,%%~C" "4,%%~D" "10,%%~A" "6,%%~F" "4,%%~G"
            "6,%%~C" "4,%%~D" "10,%%~A" "6,%%~F" "4,%%~G"
            "6,%%~C" "4,%%~D" "10,%%~A" "6,%%~F" "4,%%~G"
            "6,%%~C" "4,%%~D" "10,%%~A" "6,%%~F" "4,%%~G"
            "6,%%~C" "4,%%~D" "10,%%~A" "6,%%~F" "4,%%~G"
            "6,%%~C" "4,%%~D" "10,%%~A" "6,%%~F" "4,%%~G"
            "6,%%~C" "4,%%~D" "10,%%~A" "6,%%~F" "4,%%~G"
            "6,%%~C" "4,%%~D" "10,%%~A" "6,%%~F" "4,%%~G"
            "6,%%~C" "20,%%~F" "4,%%~G"
            "6,%%~C" "20,%%~F" "4,%%~G"
            "6,%%~C" "20,%%~F" "4,%%~G"
            "6,%%~C" "20,%%~F" "4,%%~G"
            "6,%%~C" "20,%%~F" "4,%%~G"
            "6,%%~C" "20,%%~F" "4,%%~G"
            "6,%%~C" "1,%%~D" "13,%%~E" "6,%%~F" "4,%%~G"
            "6,%%~C" "2,%%~D" "12,%%~E" "6,%%~F" "4,%%~G"
            "6,%%~C" "3,%%~D" "11,%%~E" "6,%%~F" "4,%%~G"
            "6,%%~C" "4,%%~D" "10,%%~E" "6,%%~F" "4,%%~G"
            "6,%%~C" "4,%%~D" "10,%%~A" "6,%%~F" "4,%%~G"
            "6,%%~C" "4,%%~D" "10,%%~A" "6,%%~F" "4,%%~G"
            "6,%%~C" "4,%%~D" "10,%%~A" "6,%%~F" "4,%%~G"
            "6,%%~C" "4,%%~D" "10,%%~A" "6,%%~F" "4,%%~G"
            "6,%%~C" "4,%%~D" "10,%%~A" "6,%%~F" "4,%%~G"
            "6,%%~C" "4,%%~D" "10,%%~A" "6,%%~F" "4,%%~G"
            "6,%%~C" "4,%%~D" "10,%%~A" "6,%%~F" "4,%%~G"
            "6,%%~C" "4,%%~D" "10,%%~A" "6,%%~F" "4,%%~G"
            "6,%%~C" "4,%%~D" "10,%%~A" "6,%%~F" "4,%%~G"
            "6,%%~C" "4,%%~D" "10,%%~A" "6,%%~F" "4,%%~G"
            "6,%%~C" "14,%%~F" "6,%%~I"          "4,%%~G"
            "6,%%~C" "14,%%~F" "6,%%~I" "1,%%~J" "3,%%~G"
            "6,%%~C" "14,%%~F" "6,%%~I" "2,%%~J" "2,%%~G"
            "6,%%~C" "14,%%~F" "6,%%~I" "3,%%~J" "1,%%~G"
            "6,%%~C" "14,%%~F" "6,%%~I" "4,%%~J"
            "6,%%~C" "14,%%~F" "6,%%~I" "4,%%~J"
            "1,%%~A" "6,%%~B" "14,%%~E" "5,%%~H" "4,%%~J"
            "2,%%~A" "6,%%~B" "14,%%~E" "5,%%~H" "3,%%~J"
            "3,%%~A" "6,%%~B" "14,%%~E" "5,%%~H" "2,%%~J"
            "4,%%~A" "6,%%~B" "14,%%~E" "5,%%~H" "1,%%~J"
         ) do @for /F "tokens=1-2 delims=," %%b in ("%%~a") do @(
            for /L %%d in (1, 1, %%~b) do @echo(%%~c
         )
      )
endlocal
goto :eof


:samplePPM
@echo off
shift /1
rem ppm sample image:
rem - 2x2
rem - 255 colors
rem - black, red
rem - green, white
rem
rem "P3 2 2  255  0 0 0  255 0 0  0 255 0  255 255 255"
echo(50 33 20 32 20 32 20 20 32 35 35 20 20 30 20 30
echo(20 30 20 20 32 35 35 20 30 20 30 20 20 30 20 32
echo(35 35 20 30 20 20 32 35 35 20 32 35 35 20 32 35
echo(35
endlocal
goto :eof
Note:
I've inlined an external PNG, but haven't linked it; this should be only a howto; use an own png if you want to test this.

The resulting html should be similar to this one:

Code: Select all

<html>
 <head>
  <title>Test.</title>
 </head>
 <body bgcolor="C0C0C0">
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAyCAYAAABLXmvvAAAAAXNSR0IArs4c6QAAAA
RnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAADgSURBVFhH7dhRDoIwEEXRGTdi3ElZObgS2InywhBLpTgx9K
GhhxiaWHM/KNCoj5HEVG2wpMtZbms/6zqRi40npCi8wsQoTGFyFLRfnye3ZKJXf7VBYhhsYJbXmOiQcPO2qgkQBWp4jgItHEchu
6qTRSghecDl6H391pTWzuZcqxpqmKaGaX4/rM7DyxVuvtyJbPkYLhGFzXCpKOy+58qqbyc7050vXPdcNDVMU8M0/xDGE8nz8X
GFw847kTY4wiWisBkuFYXs20nGL/Z07v+5wngN6WFEgRqeo0ALx1ERkSd/80FrhenU6AAAAABJRU5ErkJggg==" />
<img src="data:image/bmp;base64,Qk1WBgAAAAAAAHoAAABsAAAAHgAAADIAAAABACAAAwAAACAAAAATCwAAE wsAAAA
AAAAAAAAAAAD/AAD/AAD/AAAAAAAA/yBuaVcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAN//AADf/wAA3/8AAN//AADf/wAA3/8A39//AN/f/wDf3/8A39//AN/f/wDf3/8A39//AN/f/wDf3/8A39//AN/f/wDf3/8
A39//AN/f/wDf3/8A39//AN/f/wDf3/8A39//AN/f/////wD///8A////AP///wAAAN//AADf/wAA3/8AAN//AADf/wAA3/8A39//AN/f/w
Df3/8A39//AN/f/wDf3/8A39//AN/f/wDf3/8A39//AN/f/wDf3/8A39//AN/f/wDf3/8A39//AN/f/wDf3/8A39//AN/f/wC/v/////8A///
/AP///wAAAN//AADf/wAA3/8AAN//AADf/wAA3/8A39//AN/f/wDf3/8A39//AN/f/wDf3/8A39//AN/f/wDf3/8A39//AN/f/wDf3/8A
39//AN/f/wDf3/8A39//AN/f/wDf3/8A39//AN/f/wC/v/8Av7//////AP///wAAAN//AADf/wAA3/8AAN//AADf/wAA3/8A39//AN/f/w
Df3/8A39//AN/f/wDf3/8A39//AN/f/wDf3/8A39//AN/f/wDf3/8A39//AN/f/wDf3/8A39//AN/f/wDf3/8A39//AN/f/wC/v/8Av7//A
L+//////wAAAN//AADf/wAA3/8AAN//AADf/wAA3/8A39//AN/f/wDf3/8A39//AN/f/wDf3/8A39//AN/f/wDf3/8A39//AN/f/wDf3/
8A39//AN/f/wDf3/8A39//AN/f/wDf3/8A39//AN/f/wC/v/8Av7//AL+//wC/v/8AAN//AADf/wAA3/8AAN//AADf/wAA3/8A39//AN
/f/wDf3/8A39//AN/f/wDf3/8A39//AN/f/wDf3/8A39//AN/f/wDf3/8A39//AN/f/wDf3/8A39//AN/f/wDf3/8A39//AN/f/wC/v/8Av
7//AL+//wC/v/8AAN//AADf/wAA3/8AAN//AADf/wAA3/8AAL//AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD/
//8A////AP///wDAAP8AwAD/AMAA/wDAAP8AwAD/AMAA/wB/AP8Av7//AL+//wC/v/8AAN//AADf/wAA3/8AAN//AADf/wAA3/8
AAL//AAC//wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wDAAP8AwAD/AMAA/wDAAP8AwAD/AMA
A/wB/AP8AfwD/AL+//wC/v/8AAN//AADf/wAA3/8AAN//AADf/wAA3/8AAL//AAC//wAAv/8A////AP///wD///8A////AP///wD///8
A////AP///wD///8A////AP///wDAAP8AwAD/AMAA/wDAAP8AwAD/AMAA/wB/AP8AfwD/AH8A/wC/v/8AAN//AADf/wAA3/8AAN
//AADf/wAA3/8AAL//AAC//wAAv/8AAL//AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wDAAP8AwAD/AMAA/wD
AAP8AwAD/AMAA/wB/AP8AfwD/AH8A/wB/AP8AAN//AADf/wAA3/8AAN//AADf/wAA3/8AAL//AAC//wAAv/8AAL//////AP///wD
///8A////AP///wD///8A////AP///wD///8A////AADAAP8AwAD/AMAA/wDAAP8AwAD/AMAA/wB/AP8AfwD/AH8A/wB/AP8AAN//
AADf/wAA3/8AAN//AADf/wAA3/8AAL//AAC//wAAv/8AAL//////AP///wD///8A////AP///wD///8A////AP///wD///8A////AADAAP
8AwAD/AMAA/wDAAP8AwAD/AMAA/wB/AP8AfwD/AH8A/wB/AP8AAN//AADf/wAA3/8AAN//AADf/wAA3/8AAL//AAC//wAAv/
8AAL//////AP///wD///8A////AP///wD///8A////AP///wD///8A////AADAAP8AwAD/AMAA/wDAAP8AwAD/AMAA/wB/AP8AfwD/
AH8A/wB/AP8AAN//AADf/wAA3/8AAN//AADf/wAA3/8AAL//AAC//wAAv/8AAL//////AP///wD///8A////AP///wD///8A////AP//
/wD///8A////AADAAP8AwAD/AMAA/wDAAP8AwAD/AMAA/wB/AP8AfwD/AH8A/wB/AP8AAN//AADf/wAA3/8AAN//AADf/wAA
3/8AAL//AAC//wAAv/8AAL//////AP///wD///8A////AP///wD///8A////AP///wD///8A////AADAAP8AwAD/AMAA/wDAAP8AwAD
/AMAA/wB/AP8AfwD/AH8A/wB/AP8AAN//AADf/wAA3/8AAN//AADf/wAA3/8AAL//AAC//wAAv/8AAL//////AP///wD///8A////
AP///wD///8A////AP///wD///8A////AADAAP8AwAD/AMAA/wDAAP8AwAD/AMAA/wB/AP8AfwD/AH8A/wB/AP8AAN//AADf/w
AA3/8AAN//AADf/wAA3/8AAL//AAC//wAAv/8AAL//////AP///wD///8A////AP///wD///8A////AP///wD///8A////AADAAP8AwA
D/AMAA/wDAAP8AwAD/AMAA/wB/AP8AfwD/AH8A/wB/AP8AAN//AADf/wAA3/8AAN//AADf/wAA3/8AAL//AAC//wAAv/8AA
L//////AP///wD///8A////AP///wD///8A////AP///wD///8A////AADAAP8AwAD/AMAA/wDAAP8AwAD/AMAA/wB/AP8AfwD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ADAAP8AwAD/AMAA/wDAAP8AwAD/AMAA/wB/AP8AfwD/AH8A/wB/AP8AAN//AADf/wAA3/8
AAN//AADf/wAA3/8AAL//AAC//wAAv/8AAL//////AP///wD///8A////AP///wD///8A////AP///wD///8A////AADAAP8AwAD/AM
AA/wDAAP8AwAD/AMAA/wB/AP8AfwD/AH8A/wB/AP8AAN//AADf/wAA3/8AAN//AADf/wAA3/8AAL//AAC//wAAv/8AAL////
//AP///wD///8A////AP///wD///8A////AP///wD///8A////AADAAP8AwAD/AMAA/wDAAP8AwAD/AMAA/wB/AP8AfwD/AH8A/
wB/AP8AAN//AADf/wAA3/8AAN//AADf/wAA3/8AAL//AAC//wAAv/8AAL//////AP///wD///8A////AP///wD///8A////AP///wD
///8A////AADAAP8AwAD/AMAA/wDAAP8AwAD/AMAA/wB/AP8AfwD/AH8A/wB/AP8AAN//AADf/wAA3/8AAN//AADf/wAA3
/8AAL//AAC//wAAv/8AAL//////AP///wD///8A////AP///wD///8A////AP///wD///8A////AADAAP8AwAD/AMAA/wDAAP8AwA
D/AMAA/wB/AP8AfwD/AH8A/wB/AP8AAN//AADf/wAA3/8AAN//AADf/wAA3/8AAL//AAC//wAAv/8AAL//////AP///wD///8A
////AP///wD///8A////AP///wD///8A////AADAAP8AwAD/AMAA/wDAAP8AwAD/AMAA/wB/AP8AfwD/AH8A/wB/AP8AAN//A
ADf/wAA3/8AAN//AADf/wAA3/8AAL//AAC//wAAv/8AAL//////AP///wD///8A////AP///wD///8A////AP///wD///8A////AADA
AP8AwAD/AMAA/wDAAP8AwAD/AMAA/wB/AP8AfwD/AH8A/wB/AP8AAN//AADf/wAA3/8AAN//AADf/wAA3/8AAL//AAC//
wAAv/8AAL//////AP///wD///8A////AP///wD///8A////AP///wD///8A////AADAAP8AwAD/AMAA/wDAAP8AwAD/AMAA/wB/
AP8AfwD/AH8A/wB/AP8AAN//AADf/wAA3/8AAN//AADf/wAA3/8AAL//AAC//wAAv/8AAL//////AP///wD///8A////AP///wD
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wD/AP8A/wD/AP8A/wD/AP8
A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A////AP///wD///8A////AP///wC/v/8Av7//AL+//wC/v/////8A////AA
AA//8AAP//AAD//wAA//8AAP//AAD//wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8
A/wD/AP8A/wD/AP///wD///8A////AP///wD///8Av7//AL+//wC/v/////8A////AP///wAAAP//AAD//wAA//8AAP//AAD//wA
A//8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD///8A////AP///
wD///8A////AL+//wC/v/////8A////AP///wD///8AAAD//wAA//8AAP//AAD//wAA//8AAP//AP8A/wD/AP8A/wD/AP8A/wD
/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A////AP///wD///8A////AP///wC/v/8=" />
<img src="data:image/x-bmp;base64, ... same as above ... " />
<img src="data:image/x-portable-pixmap;base64,UDMgMiAyICAyNTUgIDAgMCAwICAyNTUgMCAwICAwIDI1NSAwICAyNTUgMjU1IDI1NQ==" />
<img src="data:image/x-portable-anymap;base64,UDMgMiAyICAyNTUgIDAgMCAwICAyNTUgMCAwICAwIDI1NSAwICAyNTUgMjU1IDI1NQ==" />
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" baseProfile="full" width="30px" height="50px" viewBox="0 0 30 50">
   <polygon points=" 0, 4   4, 0   10, 0   6, 4" style="fill:#FF0000" />
   <polygon points=" 6, 4  10, 0  24, 0  20, 4" style="fill:#00FF00" />
   <polygon points="20, 4  24, 0  30, 0  26, 4" style="fill:#FFFF00" />
   <polygon points=" 0, 4   6, 4   6,50   0,50" style="fill:#DF0000" />
   <polygon points=" 6, 4  20, 4  20,10   6,10" style="fill:#00C000" />
   <polygon points="20, 4  26, 4  26,10  20,10" style="fill:#DFDF00" />
   <polygon points="26, 4  30, 0  30, 6  26,10" style="fill:#BFBF00" />
   <polygon points="26,10  30, 6  30,40  26,44" style="fill:#007F00" />
   <polygon points=" 6,10  10,10  10,20   6,24" style="fill:#BF0000" />
   <polygon points=" 6,24  10,20  20,20  20,24" style="fill:#00FF00" />
   <polygon points=" 6,24  20,24  20,10  26,10  26,44  20,44  20,30   6,30" style="fill:#00C000" />
   <polygon points=" 6,30  10,30  10,40   6,44" style="fill:#BF0000" />
   <polygon points=" 6,44  10,40  20,40  20,44" style="fill:#FFFF00" />
   <polygon points=" 6,44  26,44  26,50   6,50" style="fill:#DFDF00" />
   <polygon points="26,44  30,40  30,46  26,50" style="fill:#BFBF00" />
</svg>
 </body>
</html>


penpen

Edit: I've manually splitted the base64 enccoded strings and removed the doubled bmp sample data with an alternative MIME type; use the batch to create both.
Edit2: Added the '#' to the color definition of the svg polygon definitions.

einstein1969
Expert
Posts: 961
Joined: 15 Jun 2012 13:16
Location: Italy, Rome

Re: Write image on file and view.

#10 Post by einstein1969 » 08 Dec 2015 11:13

penpen,

very very good work!

Let me studing this piece of code. :shock:

thanks

Einstein1969

npocmaka_
Posts: 516
Joined: 24 Jun 2013 17:10
Location: Bulgaria
Contact:

Re: Write image on file and view.

#11 Post by npocmaka_ » 08 Dec 2015 17:16

Data URIs are well explained here: https://css-tricks.com/data-uris/

As long as you use mshta/internet explorer you can apply dx image filters , but unfortunately the result of the filters cannot be saved.

Post Reply