Yes, it is possible with a component, but it will take a little longer as there are more directories and files.
Create a folder on your desktop (e.g "gallery"), then copy the XML file from:
ROOT/administrator/components/com_component/component_name.xml
into your newly created folder.
Step 1:
Open the XML file and inside you will see something like:
<files folder="site">
and
<files folder="admin">
So inside your gallery folder, create 2 sub-directories called "site" and "admin".
Step 2:
Now to copy the main component files.
Go to ROOT/administrator/component/com_component
and copy the entire contents (apart from the XML you copied before), into your "admin" directory
The go to ROOT/component/com_component
and copy the entire contents, into your "site" directory
Step 3:
Look again in your XML file and you will also see a reference to some language files, for example:
<languages>
<language tag="en-GB">site/languages/en-GB/en-GB.com_component.ini</language>
<language tag="en-GB">site/languages/en-GB/en-GB.com_component.sys.ini</language>
</languages>
Looking at this example, you will now need make sure you have to following directory path created:
gallery/site/languages/en-GB
Once done, copy the 2 language files (from your server):
ROOT/languages/en-GB/en-GB.com_component.ini
ROOT/languages/en-GB/en-GB.com_component.sys.ini
into the directory you create just a minute ago.
You will also need to repeat the same process for the admin language files, but of course ensuring they go in the "admin" directory instead.
Once all done, zip up the component and try installing it.
If there are any errors about missing files, have another look at the XML file and see if you've missed anything, such as media (CSS, JS etc)
Hope this helps