Bhikkhu P. A. Payutto writes:
But according to the teachings of Buddhism, all actions and
speech, all thoughts, no matter how fleeting, and the responses
of the mind to sensations received through eye, ear, nose,
tongue, body, and mind, without exception, contain elements of
intention. Intention is thus the mind’s volitional choosing of objects
of awareness; it is the factor which leads the mind to turn
towards, or be repelled from, various objects of awareness, or
to proceed in any particular direction; it is the guide or the governor
of how the mind responds to stimuli; it is the force which
plans and organizes the movements of the mind, and ultimately
it is that which determines the states experienced by the mind.
One instance of intention is one instance of kamma. When there
is kamma there is immediate result. Even just one little thought,
although not particularly important, is nevertheless not void of
consequence. It will be at the least a “tiny speck” of kamma,
added to the stream of conditions which shape mental activity.
With repeated practice, through repeated proliferation by the
mind, or through expression as external activity, the result becomes
stronger in the form of character traits, physical features
or repercussions from external sources.
-- Good, Evil and Beyond: Kamma in the Buddha's teachings
As there are physical movements that are devoid of intention (e.g. convulsions), some mental images might be understood to surface unintentionally. While the quote above asserts all thoughts to have intention, it can be argued if these are understood to be karma or not. Dreams would be in this gray area, I think.
But, while awake, any sophisticated thought, anything more than a flash of an image or a sound or taste or smell, any and all imagination containing full sentences, dialogues and motions, etc, have an active element in them which nurtures and develops them: underneath, there's the intention to imagine these things, and these imaginations are actions -- which is the meaning of karma in Buddhism.