SOLVED Get the preview images from c4d files

I saw you can browse a folder of files and get the file informations here:

Is it also possible to get the preview images from those files? And how?

Not certain it solves your problem but in this post somebody changed the preview picture in python.

not really
you can get the preview from a BaseDocument with GetDocPreviewBitmap();
but this works only with loaded files, and i don't want to load all files first.


I guess you are talking about retrieving the preview of c4d files only. If you want to retrieve preview of any kind of files, you need to use the OS functionalities and of course they are different if you are using windows or OSX.

But for c4d files you can proceed like so. You have to load the document to have access to the bitmap, but you can do it with the flag SCENEFILTER::NONE that way, the minimum will be loaded.

#include "maxon/apibase.h"
#include "maxon/errorbase.h"
#include "maxon/errortypes.h"
#include "maxon/url.h"
#include "maxon/iobrowse.h"
#include "maxon/fileformat_handler.h"
#include "maxon/dataformat.h"

#include "c4d_general.h"
#include "c4d_commanddata.h"
#include "c4d_baseplugin.h"
#include "c4d_basedocument.h"
#include "c4d_basebitmap.h"
#include "lib_description.h"
#include "customgui_bitmapbutton.h"

static maxon::Result<void> pc14103(BaseDocument* doc)
	maxon::Url baseDirectory { maxon::URLSCHEME_FILESYSTEM };
	baseDirectory.SetPath("D:/temp/c4d"_s) iferr_return;
	for (const auto& it : baseDirectory.GetBrowseIterator(maxon::GETBROWSEITERATORFLAGS::NONE))
		const maxon::Url filePath = it.GetCurrentPath() iferr_return;
		if (filePath.GetSuffix() == "c4d"_s)
			Filename maxonFile = MaxonConvert(filePath);
			BaseDocument* myDoc = LoadDocument(maxonFile, SCENEFILTER::NONE, nullptr);
			if (myDoc == nullptr)

			BaseBitmap* docPreview = myDoc->GetDocPreviewBitmap();
			if (docPreview && (docPreview->GetBw() > 0) && (docPreview->GetBh() > 0))

	return maxon::OK;


thanks that works.