How to convert a DGN file (shared cells) into a DWG file (AutoCad blocks) in FME? - autocad

Me and my colleague are currently trying to convert a DGN file (with many points) into a realDWG file. The DGN file is roughly 90 MB, since there are shared cells in the DGN file. Shared cells are elements that are stored only once in the DGN file, regardless of how often the cell is placed within the DGN file. This makes it possible to have a relatively small size for the DGN file. However when I simply connect the DGN reader and the DWG writer together, the filesize of realdwg is roughly 600MB! Apparently shared cells are during the translation to realdwg treated as an autoblock in itself, while I would like to have the same capacity in the realdwg that there is only one autoblock and the the others are referencing to that one autoblock, however still visually shown which ideally should make the realdwg smaller. Does anyone know if that can be achieved in FME?

In order to convert a DWG file to DGN format.
Steps:
1-Open the DWG file in MicroStation using File > Open
2-From Menu bar, Choose File > Save As.
3-Use [Save as type:] drop down and change to: Autodesk DWG Files (*.DWG)
4-Click [Options] and change desired settings.
https://i.stack.imgur.com/gNHcB.png
For Unsupported Dimension
-set "ON"
-Drop Unsupported Dimensions (from Advanced" Tab)
https://i.stack.imgur.com/ROKD6.jpg
Click Save.

Related

Why are images in pdf sometimes sliced into multiple images?

Noticed that images sometimes are sliced up in PDFs.
Steps:
insert an image with a high resoultion (3000x1800) into a .docx
use "Microsoft Print to PDF" option of Word to convert to PDF
extracting all images with pdfimages or pymupdf
Result:
Image is sliced horizontally into three images
Questions:
What exactly happens in the in the transition from .docx to pdf (or in generell in the process to pdf) that makes the converter slice it up into three images instead of one?
Do the individuell XObjects of the sliced images contain information which says that these three images belong to originally one?
How do I know how the images are sliced (horizontally / vertically) and what if originally there were two images inserted into the .docx file and both of them are sliced. Can you tell if slice x belongs to original image y or z?
So, as you have found out: because the code which generates the PDF choose to do so.
The technical reasons may be various - it could be that historically there were printers which would only have so much memory, and would need to get limiterd size-images when printing, and someone at some point when writing the PDF export code present in Microsoft Office choose to apply this limit.
Anyway, technically, as put in the comments, an image in a PDF file could be composed of unlimited smaller images collated together.
Now, the second part, and your actual question: to know whether images ibn a PDF file belong together in a single original image one would need a custom extractor tool to check the geometry of all images in the document and find out which images have no margins or boundaries with others - it would not be that hard to do for well behaved files (which we can't know if MS Office generated files are: there are ways to obfuscate image positioning by making it indirectly). The metadata in the image-parts may or may not contain information that would allow one to recompose the original image: it would be up to the code generating the PDF to include this metadata or not - but the geometry can't lie in this case: if the final document presents a single image visually, it is possible to detect that when fetching the images.

I am trying to get privately provided contours to be recognized by arcmap as such

I have a contour map that is provided to me by a private company. it comes in the form of a .dwg that works for autocad. In the past i have gotten contour data from usgs but the data provided to me is much more accurate. I want these contours in the .dwg to get loaded into arcmap so I can use them to delineate watersheds as per usual procedure.
Try to open .dwg file from ArcMap's add data option, locate the .dwg file, double click on it and it will show you it's sub-files, open Polyline file or any other file from it as u desire.
Then you can create its boundary and DEM to carry out your tasks.

How to extract images from a PSD file including images contained in a single layer

I don't have much knowledge of imaging tools but I need to extract images contained within the layers of a psd file. I tried using GIMP with a "save all layers" plugin but that is just saving the root layers so I am ending up with just two .pngs. I need every image in a separate file with the correct sizes.
The reason I need the files is that I have been asking to create an animation with CSS using the images. An example animations is at http://srv1.contobox.com/frontend/ads/preview.html?id=981
The psd document I am trying to extract is
https://www.dropbox.com/sh/ud2eaesej08o0g3/AAAi-_pPHGESOFOBpA0uQfjta
The problem is that these files are structured with Layer Groups (I opened just one of them).
While GIMP is supporting open the file, the "save all layers" plug-in you are using probably is not aware of layer groups.
(BTW, GIMP unstable - the 2.9 development version is likely currently broken for opening PSDs - the image opens garbled there. It opens in gimp 2.8.10, though)
It is possible to save all layers - including sublayers, as separate images with an interaction in the Python console.
With you PSD being the only image open in GIMP, go to filters->python->console and type something along this:
img = gimp.image_list()[0] # retrieves a reference to the image
folder = "/tmp/" # folder of you choice for saving the files
counter = 0
def save_recurse(item):
global counter
if hasattr(item, "layers"):
for layer in reversed(item.layers):
save_recurse(layer)
else:
counter += 1
name = folder + "layer_%03d.png" % counter
pdb.gimp_file_save(img, item, name, name)
save_recurse(img)
(btw, I typed it here in a way you can just copy and paste the listing above in GIMP's Python console)

How to tell the difference between the original .BMP/.EMF picture file with the processed .BMP/.EMF file?

Summarization:
Calculations point out in a straight-forward way that: A .BMP picture of 3289 X 4570 X 32bpp takes about 53MB. The picture of same size but 24bpp takes about 43MB, that of 16bpp takes about 28MB. ChemDraw-processed picture file must then be converted from 24bpp to 16bpp in my situation.
Further comparison of the hex data of both files gives more detailed understanding of the difference between ChemDraw-processed picture and the original picture. Specifically, ChemDraw stores "EMF_STRETCHDIBITS" instead of "EMF_STRETCHBLT". It should be added that "EMF_STRETCHDIBITS" can be done by calling StretchDIBits when copying pixels into TMetaFile/TMetaFileCanvas. It should be also noted that pixels for "EMF_STRETCHDIBITS" should be the same as those for "EMF_STRETCHBLT".
Unfortunately, till now I didn't find out how ChemDraw exactly processes and stores pasted pictures. That is to say, I didn't find out why the pixels ChemDraw stored is different from what I can obtain programingly.
PS: I will vote up kind answers regarding this question later because I do not have enough reputation for the moment. Thanks for everybody who has been kind to comment!
===
Hi,
Thanks for your time very much!
Say that I have a picture named "sample_original.bmp". The file size is 3289 X 4570, 43MB. Then I do the following to convert it into a .EMF file (Enhanced Windows MetaFile):
Method 1, by making a small in-house Delphi program:
(1) Load the .BMP image file.
(2) Obtain the Canvas of TMetaFile(TMetaFileCanvas)
(3) Call Canvas.Draw to copy the image.
(4) Save to .EMF file, named "sample_original_bmp2emf_method1.emf"
Method 2:
(1) Open the .BMP image file in the mspaint program, choose "select all", and choose "copy".
(2) Open an external program called ChemDraw, create new document, and choose "paste".
(3) Then I choose to save that in the XML-compatible .cdxml format, named "sample_original_bmp2emf_method2.cdxml".
(4) The content of picture (maybe changed or degraded?) is now saved in the sample_original_bmp2emf_method2.cdxml file. The format is Base64-encoded zlib-compressed format.
(5) I can Base64-decode the XML string, zlib-decompress it, and save it into the picture file "sample_original_bmp2emf_method2.emf".
The file size of sample_original_bmp2emf_method2.emf is smaller by 15 MB than sample_original_bmp2emf_method1.emf, but the width & height has been maintained.
Furthermore, if I open "sample_original_bmp2emf_method2.emf" in the mspaint program and save it back into .bmp file format, a warning pops up that transparent information is losing.
Could you help to comment on how to tell the difference "sample_original_bmp2emf_method1.emf" & "sample_original_bmp2emf_method2.emf"? Is the picture smaller because its quality is decreased?
In other words, what changes to my original picture could possibly be made by this external program?
Best wishes,
The files mentioned above can be downloaded in the following url:
http://www.rapidspread.com/file.jsp?id=2ighvzoci8
PS: I believe that Andreas Rejbrand has be kind enough to made his answer and I then gave my comments. But I cannot see those now. Is it supposed to be normal behavior of the system? o_o
You wrote:
Base64-decode the XML string, zlib-decompress it, and save it into the picture file "sample_original_bmp2emf_method2.emf".
So it's definitively NOT an emf file, but some zipped format..
Or it was converted to another format (like vectorial) before converting to XML. In this case, you've less data in the resulting picture than a real bitmap.
Whereas the first method will give you an emf file with a size of only a few bytes bigger than a plain bmp file (i.e. the emf records used to encapsulate the bitmap data).
If you zip the emf file of the first method, I'm quite sure you'll get a file with a smaller size than the false emf obtained by method two.
Why don't you just compare the two images? Open them in a raster editing program and compare the pixels.
Why do you care how big the files are? Surely what's important is whether or not the image is the right one.

Decompress "wmz" file

When we try to save msword doc file as html file we get "wmz" files for the math equation objects.
I tried decompressing the wmz file and saving the content as jpg.
I can open this jpg file in the "Microsoft Picture manager" properly. But trying to open the file in browser displays the error message "The image cannot be displayed, because it contain errors".
What is the procedure to decompress this wmz file and convert it to jpg.
What will be the extension of decompressed file?
.WMZ seems to be a zipped .WMF file.
You can open the unzipped file with a picture view/editor (just tried IrfanView) and save as .jpg.
When you save your Word documents as "Web Page, filtered" you won't get these WMZ files but just PNG files.
Set the "Web Options" to target to a low version of IE (i.e. 4.0) and check "allow PNG files" and "disable features not supported by these browsers".
Added advantage is that the webpage will display better in different browsers.
However, you should do all of this after you first make a copy of your document (and associated files) using Explorer into another location. Open this copy with Word and then Save as "Web Page, filtered". The original you keep for editing. (Don't save the original as a "web page, filtered" or you will loose the ability to edit the equation objects).
Thanks for the help.
Finally i could not remove the black background from the image file.
So using the round about approach for now
1)Decompress the wmz file to byte array(wmf).
2)Open a new word document
3)Paste the byte array into word document.(this document should only contain this data, and no other extra information)
4)Save the doc as html file (WdSaveFormat.wdFormatFilteredHTML)
5)open the "_files" directory created for the html output
6)Find the only "gif" file created inside the directory

Resources