64x64 Image Converter

0 views
Skip to first unread message

Pelagio Bosch

unread,
Aug 4, 2024, 11:17:12 PM8/4/24
to dryworentat
1Click the "Choose Files" button to select multiple files on your computer or click the "URL" button to choose an online file from URL, Google Drive or Dropbox. Image file size can be up to 200M. You can use file analyzer to get source image's detailed information such as image size, resolution, quality and transparent color.

2. Set target image format, image quality and image size. You can use the original image size or select the "Change width and height" option and enter a custom image size. The format is [width]x[height], for example: 1920x1080. The image quality option only works on a few image formats such as JPG, WEBP or AVIF. The value ranges from 1 (lowest image quality and highest compression) to 100 (best quality but least effective compression). If this value is blank, the converter will use the estimated quality of your input image if it can be determined, otherwise 92. The target image format can be JPG, PNG, TIFF, GIF, HEIC, BMP, PS, PSD, WEBP, TGA, DDS, EXR, J2K, PNM, SVG, etc.


3. Click the "Convert Now!" button to start batch conversion. It will automatically retry conversion on another server if one fails, please be patient while converting. The output files will be listed in the "Conversion Results" section. Click icon to show file QR code or save file to cloud storage services such as Google Drive or Dropbox.


Image files are composed of digital data in one of image file format that can be rasterized for use on a computer display or printer. An image file format may store data in uncompressed, compressed, or vector formats. A raster graphics image is a dot matrix data structure, representing a generally rectangular grid of pixels, or points of color. As opposed to the raster image formats, vector image formats contain a geometric description which can be rendered smoothly at any desired display size.


Looking at the dumped image in a hex editor, it looks as though it might be some sort of run length encoding, as I can see the 16bit color data inline, however it does not appear to be just the raw pixel data. It looks as though the data is broken up into 5 word (20 byte) chunks with the first word possibly defining how to interpret the next 8 pixel data.


I created a custom tft with the following 64x64 image



And here is a link to a hexdump of the image that was extracted from this tft. The pixel data is 1300 bytes with an additional 576 bytes at the end, a palette perhaps?


Pixels appear to be broken up into packets of 5 words. The last 4 are the raw pixel data broken into 2 RGB565 colors per word for a total of 8 colors. The first word is broken up into 8 4-bit nibbles where each nibble corresponds to the number of times the pixel in the corresponding half-word should be repeated.


I am building a basic cnc drawing machine (sort of) for a project. My hope is to convert the image to a 2D matrix with values of 0, 1, or 2, corresponding with white, gray, and black. The drawing arm will go back and forth across the drawing area in the X direction, and then do and up and down path for the Y direction. White "pixels" are passed over in both directions, gray get a single pass (in the X direction, say), and black gets a pass in both directions.


Conceptually, if I had the array, I could write the code to control my two steppers and the solenoid for my pen. How might I go about converting to the array? Is there maybe some simple online tool for this?


But consider the size of such an array, if you want it to fit into Arduino SRAM, EEPROM or flash memory. You may be better off with sending the required data sequentially to the Arduino, with the image converter running on the PC.


There is simply not enough memory. What you can do however is to write a program in a language called Processing that will take an image file and produce a file of Gcode instructions for you to feed into your Arduino which then takes these instructions and moves your drawing machine. I did exactly this for my CNC miller project CNC conversion. You are welcome to the Processing code to get you started but I think this is way above a beginner level thing to do.


Kevin, I am essentially placing dots. Or rather, very short lines. CNC is not the best description, admittedly. I guess what I am asking for is not actually related to the Arduino. It's more about reading an image file and converting it to a simple array. A 200x200 pixel image, reduced to an array, could theoretically be reduced to a 40kb array, correct? Assuming I set the values within the array to 1 or 0, that is. Would an arduino mega be unable to handle that?


I ended up using an application called LCDAssistant, which converted my image to an array of bytes. Then I just copied and pasted that into PROGMEM and interpreted it with the arduino. For my project demonstration, I used a 64x64 pixel, black and white "M". Could have done a better resolution, but the imprecision of my drawing mechanism was the limiting factor. I did one 96x96 drawing, and while it was discernible, it wasn't great.


With Kamuix writing a guide on inserting maps into the N64 version, I got busy looking into how it would be possible to more-or-less automatically generate height maps of C&C maps, so inserted maps actually look good in N64.


C&C terrain is not three-dimensional, but gives an illusion of 3D with the images on the cliffs. However, this illusion falls flat (literally) in a real 3D environment. To remedy this problem, they added greyscale images to the missions in N64 that indicate the elevation of the terrain (brighter = higher). So if you want to import maps into an N64 ROM and have them actually look good, they are going to need a height map too.


Elevation is not done per cell, but on the four corners of each cell. Because of this, the height map images have a size of 65x65, whereas C&C maps are only 64x64 cells. However, the converter takes care of that automatically, so we'll just focus on making a 64x64 height map.


Open the map you want to make a height map for. The process works best if there's a .ini file with it that tells the program which theater the map is, and how big the actual used area on the map is. The ini file itself will not be accepted by the program, so open either the .bin file, or the already-converted .map for the N64.


You will end up with an image which has a dark gray background, and only the cliffs on it, in a slightly brighter gray. Note that this is a paletted image with five colours; even if the image is later saved as high-colour, it will be matched back to these five colours to be interpreted as height levels.


As you see, the image has some modifications compared to the original; the conversion takes the last terrain types encountered at the edges of the actually used portion of the map, and stretches them to the full frame. This is done so cliffs placed outside a map's border to control reinforcements would not influence the height map.


Now the real work. Open the saved image file in your favourite image editor, and connect the cliffs to form closed areas. To do this correctly, open the map itself in a map editor so you can see the directions of the cliffs, and see what kind of elevation each area should have. Here's my process in a few steps:


It doesn't matter if the image is saved in high colours, but as noted before, the converter will match it back to the five colours in the original image's palette, so there's no use in making detailed slopes in this. Its only function is to separate the terrain into levels.


Now we got our levels image this is fairly simple. Once again, load the map into the converter program. Open the "Convert" menu, go to "Height map generation", and now select "To height map using levels (from map)".


Now the real magic happens. It will generate an image that adapts the terrain to the new heights, and if your cliffs match your levels image correctly, it will make sharp elevations for the cliffs and smooth slopes for the openings where the level decreases on non-cliff terrain. Furthermore, the height of rivers and other water will be applied on each specific level.


Once this step is done, feel free to save the image if you want to add some more specific tweaks to it, or fix any errors the generator might have made. If you think the map is good enough, though, you can continue straight to the next step.


First things first: go to "Convert", "Height map generation", and select the final option: "To 65x65 height map image (from image)". As you see, this is the only option in there that doesn't use a C&C map as input but an image.


To add even more power to your multiverter, a sample rate converter hardware module is available. It features 64x64 channel bi-directional, asynchronous sample rate conversion between two arbitrary sample rates and interfaces. Finally you can convert 96kHz streams into 48kHz and vice versa, or accept any incoming signal without caring about the master clock!


AJA FiDO fiber converters expand your range all the way up to 10km with Single Mode. Transceivers, transmitters and receivers available with SC or ST connectivity and LC Multi-Mode or Single Mode options.


Take full control of aspect ratio, image rotation and frame rate conversion with on-screen controls in the DashBoard software that shows you what your source and output will look like, including the formats that are coming in and the choices you have made for the signal going out.


You're able to easily create highly effective and engaging displays by using additional OG-ROI-SDI openGear converters. By utilizing three OG-ROI-SDI openGear converters in the appropriate rackframe you can feed three display monitors side by side, each rotated to portrait mode. By using the SDI pass through of the OG-ROI-SDI, the SDI routed image is in sync, with each OG-ROI-SDI providing the necessary Region of Interest output via SDI. Settings for each of the OG-ROI-SDI openGear converters is provided via ethernet control through an ethernet switch. The result is a visually exciting and creative way to feed display content.

3a8082e126
Reply all
Reply to author
Forward
0 new messages